Reputation: 233
I am trying to learn to migrate one spring XML based application to spring boot application and wondering with one scenario where we have multiple constructors in a class and wish to inject all these using spring annotation.
I do understand and implemented the way using XML based configuration but confused with which annotation/way to inject multiple constructors.
I tried referring to few forums like : Ambiguity Regarding Spring Constructor Injection but no luck with spring boot. Could anyone please help on this please?
Upvotes: 1
Views: 683
Reputation: 4120
As it was mentioned in comments you can use @Configuration
@Configuration
public class Config {
@Bean
public Employee employee() {
return new Employee(10,"100");
}
}
Upvotes: 1