0

I was trying to create a configuration class

 @Configuration
 public class AppConfig {

 private final SomeBean someBean;
 private final AnotherBean anotherBean;

 @Autowired
 public AppConfig(SomeBean someBean, AnotherBean anotherBean) {
     this.someBean = someBean;
     this.anotherBean = anotherBean;
 }     

}

Another approach with

@Configuration
 public class AppConfig {

 @Autowired
 private final SomeBean someBean;

 @Autowired
 private final AnotherBean anotherBean;



}

Not sure which one I have to go for.

I have seen many codes with the second approach, but not with the first approach.

Any reason for this?

Cork Kochi
  • 1,783
  • 6
  • 29
  • 45

0 Answers0