分布式项目配置工程,在项目间互通要先在linux下开启zookeeper

一、编写配置文件

<?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="dubbodemo-service"/>
<!--配置连接zookeeper的ip和端口号-->
<dubbo:registry address="zookeeper://192.168.200.128:2181"/>
<!--配置扫描包,在这个包下实现类中使用@Service注解才会生效-->
<dubbo:annotation package="cn.zrf.service"/>
</beans>
二、编写web.xml配置文件
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
<display-name>Archetype Created Web Application</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
posted @ 2019-08-02 16:16  怕黑,可是却恋上了夜  阅读(222)  评论(0编辑  收藏  举报