beans.xml配置:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">
<jaxws:client
id="accountClient"
address="http://192.168.2.100:8080/DuanXin/services/accountServices"
serviceClass="com.hongxin.account.AccountDaoInterface"/>
<jaxws:client
id="sendMessageClient"
address="http://192.168.2.100:8080/DuanXin/services/sendMessage"
serviceClass="com.hongxin.account.SendMessageInterface"/>
<jaxws:client
id="sendMessageDaoClient"
address="http://192.168.2.100:8080/DuanXin/services/querySendMessage"
serviceClass="com.hongxin.account.SendMessageDaoInterface"/>
<jaxws:client
id="userAccountDaoClient"
address="http://192.168.2.100:8080/DuanXin/services/userAccount"
serviceClass="com.hongxin.account.UserAccountDaoInterface"/>
<jaxws:client
id="receiveMessageDaoClient"
address="http://192.168.2.100:8080/DuanXin/services/receiveMessage"
serviceClass="com.hongxin.account.ReceiveMessageDaoInterface"/>
</beans>
当然工程里要把众多的接口类写上
客户端代码:
ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
AccountDaoInterface account = (AccountDaoInterface) context.getBean("accountClient");