BAEL-453: How to use the Spring FactoryBean - use custom bean name (#866)
* custom bean name * @Autowire
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
b6403fc1f0
commit
7676697c4c
@@ -6,16 +6,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class FactoryBeanAppConfig {
|
||||
|
||||
@Bean
|
||||
@Bean(name = "tool")
|
||||
public ToolFactory toolFactory() {
|
||||
ToolFactory factory = new ToolFactory();
|
||||
factory.setFactoryId(7070);
|
||||
factory.setToolId(2);
|
||||
return factory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Tool tool() throws Exception {
|
||||
return toolFactory().getObject();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user