Spring 使用的设计模式的名称是什么
我正在努力确定我用来连接spring容器和CDI容器的设计模式的名称。这是我编写的在CDI容器中使用SpringBean的类:Spring 使用的设计模式的名称是什么,spring,design-patterns,cdi,Spring,Design Patterns,Cdi,我正在努力确定我用来连接spring容器和CDI容器的设计模式的名称。这是我编写的在CDI容器中使用SpringBean的类: @ApplicationScoped public class CDIFactory { ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/context/application-context.xml"); @Produce
@ApplicationScoped
public class CDIFactory {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/context/application-context.xml");
@Produces
public ServiceManager facadeServices(){
return (ServiceManager) applicationContext.getBean("ServiceManager");
}
非常感谢您的帮助。
CDIFactory
是单例的,因为它用@ApplicationScoped
注释,CDIFactory\facadeServices
是工厂方法,因为它提供了ServiceManager
实例/实例。正如类名所示?或或者有更深层次的东西吗?可能是ServiceFacade?可能是ServiceFacade?@PavelHoral我不确定是不是工厂,这就是为什么我要找你suggestions@JuanZe谢谢你的建议,我会努力的。我只是想澄清一下,我还没有回答我的问题。我使用CDI工厂名称是因为我认为工厂DP最接近我的问题。