`

设计:Spring动态注入implementation 、业务处理过程抽象

阅读更多

场景:
接口或抽象类,有多个实现/子类。使用Spring,&Autoinjected关联的是接口/抽象类,怎么让spring可以在运行时动态注入具体的实现那?

参考:
How to use @Autowired to dynamically inject implementation like a factory pattern
http://stackoverflow.com/questions/5725222/how-to-use-autowired-to-dynamically-inject-implementation-like-a-factory-patter
How to get beans created by FactoryBean spring managed?
http://stackoverflow.com/questions/4970297/how-to-get-beans-created-by-factorybean-spring-managed


上面的场景,是因为我们希望将业务处理过程抽象出来,将各种实现中公共的部分放到一个抽象类中。这种业务处理过程的抽象,用Method chaining,或builder,或结合使用其他的设计模式,哪个比较好那?

参考:
Method chaining with value objects
http://stackoverflow.com/questions/1981769/method-chaining-with-value-objects
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics