优化: pom依赖,reidsConfig mybatisConfig 加入到common模块

This commit is contained in:
wangiegie@gmail.com 2017-10-30 10:51:43 +08:00
parent 3f3c0ef209
commit d4fba1fdae
12 changed files with 84 additions and 91 deletions

View File

@ -1,5 +1 @@
## what is spring cloud ?
Spring Cloud builds on Spring Boot by providing a bunch of libraries that enhance the behaviour of an application when added to the classpath. You can take advantage of the basic default behaviour to get started really quickly, and then when you need to, you can configure or extend to create a custom solution.
## why use spring cloud ?
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer's own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.
2017年10月30日 1.0-ALPHA

View File

@ -5,7 +5,7 @@
<groupId>com.github.pig</groupId>
<artifactId>pig-admin-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-admin-service</name>
@ -14,14 +14,14 @@
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${pig.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.pig</groupId>
<artifactId>pig-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
</dependency>
</dependencies>

View File

@ -5,7 +5,7 @@
<groupId>com.github.pig</groupId>
<artifactId>pig-auth-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-auth-service</name>
@ -14,24 +14,14 @@
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${pig.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.pig</groupId>
<artifactId>pig-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<!--Redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--添加spring对cache的支持-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
<version>${pig.version}</version>
</dependency>
<!--oauth2.0-->
<dependency>

View File

@ -2,20 +2,20 @@ package com.github.pig.auth;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
/**
* @author lengleng
* 获取用户信息也是通过这个应用实现
* 这里既是认证服务器也是资源服务器
* EnableResourceServer
* 获取用户信息也是通过这个应用实现
* 这里既是认证服务器也是资源服务器
* EnableResourceServer
*/
@SpringBootApplication
@EnableResourceServer
@EnableDiscoveryClient
@ComponentScan(basePackages = {"com.github.pig.auth","com.github.pig.common.config"})
public class PigAuthServerApplication {
public static void main(String[] args) {

View File

@ -16,4 +16,3 @@ spring:
enabled: true
profile: dev
label: master

View File

@ -1,58 +1,68 @@
<?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>
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.github.pig</groupId>
<artifactId>pig-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<groupId>com.github.pig</groupId>
<artifactId>pig-common</artifactId>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-common</name>
<description>common</description>
<name>pig-common</name>
<description>common</description>
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>${pig.version}</version>
</parent>
<dependencies>
<!--JWT-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
<!--MySQL-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- mybatis-plus start -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<version>1.0.5</version>
</dependency>
<!--myabtis-plus 代码生成依赖-->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<!--mybatis-plus end -->
</dependencies>
<dependencies>
<!--JWT-->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.7.0</version>
</dependency>
<!--Redis-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<!--添加spring对cache的支持-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<!--MySQL-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- mybatis-plus start -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>2.1.4</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<version>1.0.5</version>
</dependency>
<!--myabtis-plus 代码生成依赖-->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-engine-core</artifactId>
<version>2.0</version>
</dependency>
<!--mybatis-plus end -->
</dependencies>
<build>
<plugins>
</plugins>
</build>
<build>
<plugins>
</plugins>
</build>
</project>

View File

@ -1,4 +1,4 @@
package com.github.pig.auth.config;
package com.github.pig.common.config;
import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
* @date 2017/10/29
*/
@Configuration
@MapperScan("com.github.pig.auth.mapper")
@MapperScan("com.github.pig")
public class MybatisPlusConfig {
@Bean
public PaginationInterceptor paginationInterceptor() {

View File

@ -1,11 +1,9 @@
package com.github.pig.auth.config;
package com.github.pig.common.config;
import com.github.pig.common.constant.CommonConstant;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachingConfigurerSupport;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheManager;
@ -21,9 +19,9 @@ import org.springframework.data.redis.serializer.StringRedisSerializer;
@Configuration
@EnableCaching
public class RedisCacheConfig extends CachingConfigurerSupport {
@Value("${redis.cache.expiration}")
@Value("${redis.cache.expiration:3600}")
private Long expiration;
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
RedisCacheManager rcm = new RedisCacheManager(redisTemplate);

View File

@ -5,7 +5,7 @@
<groupId>com.github.pig</groupId>
<artifactId>pig-config</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-config</name>
@ -14,7 +14,7 @@
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${pig.version}</version>
</parent>
<dependencies>

View File

@ -5,7 +5,7 @@
<groupId>com.github.pig</groupId>
<artifactId>pig-eureka</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-eureka</name>
@ -14,7 +14,7 @@
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${pig.version}</version>
</parent>
<dependencies>

View File

@ -5,7 +5,7 @@
<groupId>com.github.pig</groupId>
<artifactId>pig-gateway</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-gateway</name>
@ -14,14 +14,14 @@
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${pig.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.pig</groupId>
<artifactId>pig-common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>${pig.version}</version>
</dependency>
<!--zuul网关-->
<dependency>

View File

@ -6,7 +6,7 @@
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>1.0-SNAPSHOT</version>
<version>${pig.version}</version>
<packaging>pom</packaging>
<parent>
@ -20,7 +20,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<pig.version>1.0-SNAPSHOT</pig.version>
<pig.version>1.0-ALPHA</pig.version>
</properties>
<!--公共依赖-->