I have a bean like this:
@Bean
public String myBean(){
return \"My bean\";
}
I want to autowire it:
@Autowired
@Qualifi
What you are asking is already available in Spring 4.3.3
By default, configuration classes use a @Bean method’s name as the name of the resulting bean. This functionality can be overridden, however, with the name attribute.
@Configuration
public class AppConfig {
@Bean(name = "myFoo")
public Foo foo() {
return new Foo();
}
}