1、
<import resource="dubbo/spring-dubbo.xml"/>
2、
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd">
<description>Spring dubbo Configuration</description>
<!--允许扫描使用properties配置文件-->
<context:property-placeholder location="classpath*:/dubbo/*.properties" ignore-unresolvable="true"/>
<!-- 使用Annotation自动注册Bean,解决事物失效问题:在主容器中不扫描@Controller注解,在SpringMvc中只扫描@Controller注解。 -->
<context:component-scan base-package="com.yjjk.peis.service"/>
<import resource="dubbo.xml"/>
</beans>
3、
4、
<?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:dubbo="http://code.alibabatech.com/schema/dubbo"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://code.alibabatech.com/schema/dubbo
http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
<dubbo:application name="${zkServiceAppName}" owner="peis" organization="yjjk"/>
<dubbo:registry address="${zookeeper}" timeout="500000" group="${dubbo.registry.group}" id="peisRegistry"/>
<!--<dubbo:protocol name="http" port="8889"/>-->
<!--<dubbo:protocol name="dubbo" port="8889"/>-->
<!--<dubbo:protocol name="hessian" port="8890"/>-->
<!--<dubbo:protocol name="webservice" port="8892"/>-->
<!--<dubbo:protocol name="dubbo" serialization="kryo" optimizer="com.alibaba.dubbo.demo.SerializationOptimizerImpl"/>-->
<!-- 用rest协议在8080端口暴露服务 默认jetty
<dubbo:protocol name="rest" port="8888" server="tomcat"/>-->
<dubbo:protocol name="rest" port="${dubbo.port}" />
<dubbo:annotation package="com.yjjk.peis.service"/>
<import resource="dubbo-expose.xml"/>
<dubbo:provider filter="AuthorityFilter" />
</beans>
注:dubbo-expose.xml文件没用,已配置为扫描包下的类,类通过注解方式向注册中心注册服务
这个包下的类: