springboot读取xml配置
1、xml配置文件放在resources目录下2、启动类加上注解@ImportResource(“classpath:testi.xml”)3、使用spring容器取出bean@AutowiredApplicationContext appContext;..main..{appContext.getBean("workTestService")}注:xml内容:<?xml version=
·
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"为本地接口
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)