搭建一个普通的maven工程,可以参考:platform-api的搭建http://www.jianshu.com/p/ff1e791d8679
pom.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.delsk</groupId>
<artifactId>platform-provider</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>platform-provider</name>
<description>provider</description>
<parent>
<groupId>com.delsk</groupId>
<artifactId>platform-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.delsk</groupId>
<artifactId>platform-base</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.delsk</groupId>
<artifactId>platform-api</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
结构如图
image.png这几个包都按照普通项目使用,不再多说
image.png
serviceProvider包,用于远程接口方法的发布,这里面的service要实现platform-api包中的接口
image.png
application.properties
server.port=8891
spring.profiles =dev
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/crm?createDatabaseIfNotExist=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
spring.datasource.username =root
spring.datasource.password =
spring.http.encoding.force=true
spring.http.encoding.charset=utf-8
spring.http.encoding.enabled=true
server.tomcat.uri-encoding=utf-8
# REDIS (RedisProperties)
spring.redis.database= 0
spring.redis.host=localhost
spring.redis.password=
spring.redis.port=6379
spring.redis.pool.max-idle=8
spring.redis.pool.min-idle=0
spring.redis.pool.max-active=8
spring.redis.pool.max-wait=-1
dubbo.properties
dubbo.application.name=provider
dubbo.application.logger=slf4j
dubbo.annotation.package=com.delsk
dubbo.protocol.name=dubbo
dubbo.protocol.port=20880
dubbo.protocol.accessLog=true
dubbo.provider.timeout=3000
dubbo.provider.retries=1
dubbo.provider.delay=-1
dubbo.registr.protocol=zookeeper
dubbo.registry.address=127.0.0.1:2181
dubbo.registry.register=true
dubbo.registry.subscribe=true
网友评论