分布式服务
来源:互联网 发布:c语言scanf 编辑:程序博客网 时间:2024/06/05 18:09
分布式服务详解:
1)建立一个maven project
项目名po。
其实就是写一个实体类。
Pom.xml:<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<verbose />
<bootclasspath>${java.home}/lib/rt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
2)建立 maven project
项目名daoservice
Pom.xml:
(1)<parent>
<artifactId>app-core</artifactId>
<groupId>com.fangjian.framework</groupId>
<version>0.0.1</version>
</parent>
(2) <build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
(3)引入po
创建dao、mapping、service;依次写代码。
3)写一个maven web:
项目名:serviceweb(里面没有java代码)
(1):添加jdbc.properties、log4j.properties、spring-dubbo-provider.xml、spring-mybatis.xml
Pom.xml:
<parent>
<artifactId>app-core</artifactId>
<groupId>com.fangjian.framework</groupId>
<version>0.0.1</version>
</parent>;
<build>
<finalName>webapp-core</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>;
添加po、daoservice;
Web.xml:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:spring-mybatis.xml,classpath*:spring-dubbo-provider.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
打开zook注册中心;
然后打包serviceweb;放在tomact下运行。
(4)建立maven web:
项目名demoweb
在resource下添加:log4j.properties、springmvc.xml、spring-dubbo-customer.xml
<dubbo:registryaddress="zookeeper://192.168.3.253:2181" />
Pom.xml:
1): <parent>
<artifactId>app-core</artifactId>
<groupId>com.fangjian.framework</groupId>
<version>0.0.1</version>
</parent>;
引入po、daoservice
<param-value>classpath:spring-dubbo-customer.xml</param-value>
<springmvc>
写dao层的代码;
- 分布式服务
- 分布式服务框架 Zookeeper
- 分析分布式服务框架
- 分布式服务框架 Zookeeper
- 分布式协调服务---Zookeeper
- 分布式服务框架 Zookeeper
- 分布式服务框架 Zookeeper
- 分布式服务超时问题
- 分布式服务框架
- 信息分布式服务
- ZooKeeper--分布式服务框架
- zookeeper 分布式锁服务
- 分析分布式服务框架
- 分布式服务框架 Zookeeper
- 分布式服务框架 Zookeeper
- 分布式服务框架 Zookeeper
- 分布式锁服务
- 分布式web服务架构
- 汇编--学习笔记(七)-数据传送指令
- 2924 数独挑战
- Kotlin for Android (II)创建一个工程
- Java实现单链表基本操作
- Google 的软件工程经验总结
- 分布式服务
- Lagom参考指南(三)
- 在构造器中为什么this或super必须放在第一行?
- java内存过高问题定位
- TF/02_TensorFlow_Way/03 Working with Multiple Layers04 Implementing Loss Functions
- KMP算法java实现
- Live555源码解析(2)
- Nginx 单IP下 配置多个server https 启示录
- Unity3d 编辑器 TreeView教程