Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring 使用的设计模式的名称是什么_Spring_Design Patterns_Cdi - Fatal编程技术网

Spring 使用的设计模式的名称是什么

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

我正在努力确定我用来连接spring容器和CDI容器的设计模式的名称。这是我编写的在CDI容器中使用SpringBean的类:

   @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最接近我的问题。