1、pom文件配置
<parent>
<artifactId>tianyan-interface</artifactId>
<groupId>site.teapot</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tianyan-interface-pasom</artifactId>
<packaging>jar</packaging>
<name>tianyan-interface-pasom</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jjwt.version>0.9.0</jjwt.version>
<mybatisplus-spring-boot-starter.version>1.0.5</mybatisplus-spring-boot-starter.version>
<mybatisplus.version>2.1-gamma</mybatisplus.version>
<HikariCP.version>2.4.13</HikariCP.version>
<mndd.model.version>0.0.1</mndd.model.version>
<mndd.model.groupId>com.mndd.snapshot</mndd.model.groupId>
<mndd.model.artifactId>spring-boot-model</mndd.model.artifactId>
<springboot.version>2.0.4.RELEASE</springboot.version>
<lombok.version>1.16.14</lombok.version>
<spring-cloud.version>2.0.1.RELEASE</spring-cloud.version>
<druid.version>1.1.10</druid.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${springboot.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-openfeign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
<!-- Mysql 驱动 与 数据连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>${springboot.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.6</version>
</dependency>
<!-- sqlserver的数据库驱动包 -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
<!-- mybatis-plus begin -->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatisplus-spring-boot-starter</artifactId>
<version>${mybatisplus-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>${mybatisplus.version}</version>
</dependency>
<!-- mybatis-plus end -->
<!-- https://mvnrepository.com/artifact/org.apache.velocity/velocity 开源引擎模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.2</version>
</dependency>
<!--lombok插件依赖 -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>${spring-cloud.version}</version>
</dependency>
<dependency>
<groupId>site.teapot</groupId>
<artifactId>tianyan-interface-utils</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>tianyan-interface-pasom</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArguments>
<extdirs>${project.basedir}/lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding><!-- 过滤后缀为pem、pfx的证书文件 -->
<nonFilteredFileExtensions>
<nonFilteredFileExtension>pem</nonFilteredFileExtension>
<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
<nonFilteredFileExtension>p12</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<targetPath>BOOT-INF/classes/</targetPath>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>application-dev.properties</exclude>
<exclude>application-test.properties</exclude>
<exclude>application-prod.properties</exclude>
<exclude>application.properties</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>application-${profileActive}.properties</include>
<include>application.properties</include>
</includes>
</resource>
</resources>
</build>
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<profileActive>dev</profileActive>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<profileActive>prod</profileActive>
</properties>
</profile>
</profiles>
2、配置文件
2.1基础配置文件
spring.profiles.active=@profileActive@
#DRUID POOL Congif
spring.datasource.initialSize=5
spring.datasource.minIdle=5
spring.datasource.maxActive=20
spring.datasource.maxWait=60000
spring.datasource.timeBetweenEvictionRunsMillis=60000
spring.datasource.minEvictableIdleTimeMillis=300000
spring.datasource.validationQuery=SELECT 1 FROM DUAL
spring.datasource.testWhileIdle=true
spring.datasource.testOnBorrow=false
spring.datasource.testOnReturn=false
spring.datasource.poolPreparedStatements=true
spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
spring.datasource.filters=stat,wall,log4j
spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#Default DataBase Source
#spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#mybatis
mybatis-plus.mapper-locations=classpath\:sqlMapperXml/*Mapper.xml,classpath\:sqlMapperXml/**/*Mapper.xml
mybatis-plus.typeAliasesPackage=com.dream.team.model
mybatis-plus.global-config.id-type=2
mybatis-plus.global-config.field-strategy=2
mybatis-plus.global-config.auto-set-db-type=true
mybatis-plus.global-config.db-column-underline=true
mybatis-plus.global-config.refresh-mapper=true
mybatis-plus.configuration.map-underscore-to-camel-case=true
mybatis-plus.configuration.cache-enabled=false
mybatis-plus.configuration.call-setters-on-nulls=true
spring.jpa.show-sql = true
logging.level.org.springframework=DEBUG
logging.level.org.spring.springboot.dao=DEBUG
2.2 开发环境配置环境
server.port=8203
server.session.timeout=10
server.tomcat.uri-encoding=UTF-8
spring.application.name:pasom
#eureka.client.serviceUrl.defaultZone: http://10.48.39.2:9999/eureka/
eureka.client.serviceUrl.defaultZone: http://localhost:9999/eureka/
spring.datasource.url=jdbc:sqlserver://xx.xx.xx.xxx;Databasename=pasom
spring.datasource.username=xx
spring.datasource.password=xxxx
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
# enabled hystrix
feign.hystrix.enabled=true
hystrix.command.default.execution.timeout.enabled=false
ribbon.ReadTimeout=300000
ribbon.SocketTimeout=300000
ribbon.ConnectTimeout: 30000
logging.level.org.springframework=WARN
logging.level.org.spring.springboot.dao=DEBUG
logging.level= debug
logging.level.com.dream=debug
logging.file=Fegin-Client
logging.path=log
2.3 运行环境配置
server.port=8203
server.session.timeout=10
server.tomcat.uri-encoding=UTF-8
spring.application.name:element
eureka.client.serviceUrl.defaultZone: http://eurekaServer:9999/eureka/
#eureka.client.serviceUrl.defaultZone: http://localhost:9999/eureka/
#spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:sqlserver://xx.xx.xx.xxx;Databasename=pasom
spring.datasource.username=xx
spring.datasource.password=xxxxx
spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
# enabled hystrix
feign.hystrix.enabled=true
hystrix.command.default.execution.timeout.enabled=false
ribbon.ReadTimeout=300000
ribbon.SocketTimeout=300000
ribbon.ConnectTimeout: 2000
feign.compression.request.enabled=true
feign.compression.response.enabled=true
feign.compression.request.mime-typ-types=text/xml,application/xml,application/json
feign.compression.request.min-req-request-size=2048
logging.level.org.springframework=WARN
logging.level.org.spring.springboot.dao=DEBUG
logging.level= debug
logging.level.com.dream=debug
logging.file=element
logging.path=/var/log/javaboot/element
2.4 测试环境配置
server.port=8201
server.session.timeout=10
server.tomcat.uri-encoding=UTF-8
spring.application.name:element
eureka.client.serviceUrl.defaultZone: http://10.48.39.2:9999/eureka/
#eureka.client.serviceUrl.defaultZone: http://localhost:9999/eureka/
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc\:sqlserver\://xx.xx.xx.xxx;Databasename=pasom
spring.datasource.username=xx
spring.datasource.password=xxxxx
# enabled hystrix
feign.hystrix.enabled=true
hystrix.command.default.execution.timeout.enabled=false
ribbon.ReadTimeout=300000
ribbon.SocketTimeout=300000
ribbon.ConnectTimeout: 2000
feign.compression.request.enabled=tru=true
feign.compression.response.enabled=tru=true
feign.compression.request.mime-typ-types=text/xml,application/xml,application/json
feign.compression.request.min-req-request-size=2048
logging.level.org.springframework=WARN
logging.level.org.spring.springboot.dao=DEBUG
logging.level= debug
logging.level.com.dream=debug
logging.file=Fegin-Client
logging.path=/var/log/javaboot/
网友评论