我正在努力确定用于在弹簧容器和CDI容器之间桥接的设计模式的名称。这是我写的在我的CDI容器中使用spring bean的类:
@ApplicationScoped
public class CDIFactory {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/context/application-context.xml");
@Produces
public ServiceManager facadeServices(){
return (ServiceManager) applicationContext.getBean("ServiceManager");
}
我们将不胜感激。
答案 0 :(得分:1)
CDIFactory
是Singleton,因为它使用@ApplicationScoped
注释,CDIFactory#facadeServices
是工厂方法,因为它提供了ServiceManager
个实例/实例。