1、xml配置文件放在resources目录下
2、启动类加上注解@ImportResource(“classpath:testi.xml”)
3、使用spring容器取出bean
@Autowired
ApplicationContext appContext;
..main..{
appContext.getBean("workTestService")
}
注: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:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="workTestService" autowire="byType" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://218.111.111.111:10088/iss-iddddc/work/workIntfcService" />
<property name="serviceInterface" value="com.aabblili.iss.work.service.WorkIntfcService" />
</bean>
</beans>
name="serviceUrl"为http调用路径
name="serviceInterface"为本地接口