【发布时间】:2015-01-22 21:20:32
【问题描述】:
我是新来的,我正在开发一个使用 hibernate 和 spring 依赖注入以及 SOAP Web 服务的项目。
我的问题是当我使用这个类在控制台中运行我的项目时:
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-beans.xml");
IServicesPharmacie pharmacieService = (IServicesPharmacie) context.getBean("service");
context.close();
Endpoint.publish("http://localhost:3597/Pharmacies", pharmacieService);
System.out.println("The service has been published with success!");
我的项目工作正常,因为这 3 行:
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-beans.xml");
IServicesPharmacie pharmacieService = (IServicesPharmacie) context.getBean("service");
context.close();
我可以讲述我的 spring 依赖注入。
但是我不知道如何在 glassfish 服务器上运行我的项目,并告诉他我的 spring 依赖注入,我想我最有一个 web.xml !!!!
我的 spring-beans.xml 是这样的:
<bean class="dao.PharmImpl" id="dao"></bean>
<bean class="metier.PharMetier" id="metier">
<property name="phardao" ref="dao"></property>
</bean>
<bean class="services.ServicesPharmacie" id="service">
<property name="servmetier" ref="metier" />
</bean>
</beans>
【问题讨论】:
标签: java spring dependency-injection glassfish server