BAEL-453: How to use the Spring FactoryBean - use custom bean name (#866)

* custom bean name

* @Autowire
This commit is contained in:
Diane Duan
2016-11-30 00:41:30 +08:00
committed by Grzegorz Piwowarek
parent b6403fc1f0
commit 7676697c4c
3 changed files with 7 additions and 9 deletions
@@ -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();
}
}