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?