Commit 00f74245 authored by 郭燕飞's avatar 郭燕飞 💬

service模板

parents
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
*/out/
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
description = '{artifactId}-api'
apply plugin: 'java'
apply plugin: 'maven'
dependencies {
provided('cn.com.duiba:wolf')
provided('cn.com.duiba.boot:spring-boot-ext-api')
}
@AdvancedFeignClient("{artifactId}")
package {groupId}.{artifactIdPackage}.api.remoteservice;
import cn.com.duiba.boot.netflix.feign.AdvancedFeignClient;
package {groupId}.{artifactIdPackage}.biz;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableDuibaFeignClients;
import org.springframework.context.annotation.ImportResource;
@SpringBootApplication
@ImportResource({ "classpath:/spring/spring-config.xml" })
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableDuibaFeignClients(basePackages = { "{groupId}" })
public class Application {
public static void main(String[] args) {
SpringApplication sa = new SpringApplication(Application.class);
sa.run(args);
}
}
#tomcat
server.port=1111
server.tomcat.access-log-enabled=false
server.tomcat.uri-encoding=UTF-8
#logging
logging.path=${user.home}/logs/{artifactId}
spring.application.name={artifactId}
spring.cloud.config.uri=http://configserver.dui88.com
spring.cloud.config.fail-fast=true
spring.profiles.active=dev
spring.devtools.restart.enabled=true
apply plugin: 'org.springframework.boot'
jar {
baseName = '{artifactId}'
version = ''
}
description = '{artifactId}-biz'
dependencies {
compile project(':{artifactId}-api')
compile 'cn.com.duiba.boot:spring-boot-starter-perftest'
compile 'cn.com.duiba.boot:spring-boot-starter-mybatis'
compile 'cn.com.duiba.boot:spring-boot-starter-logger'
compile 'cn.com.duiba.boot:spring-boot-starter-cat'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-jdbc'
compile 'org.springframework.cloud:spring-cloud-starter-config'
compile 'org.springframework.cloud:spring-cloud-starter-eureka'
compile 'org.springframework.cloud:spring-cloud-starter-hystrix'
compile 'org.springframework.cloud:spring-cloud-starter-ribbon'
compile 'org.springframework.cloud:spring-cloud-starter-feign'
compile 'org.apache.commons:commons-dbcp2'
compile 'mysql:mysql-connector-java'
compile 'javax.validation:validation-api'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
install {//
enabled = false
}
uploadArchives {//
enabled = false
}
<?xml version="1.0" encoding="UTF-8"?>
<included>
<property name="logpath" value="${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}"/>
<property name="logPattern" value="%d{HH:mm:ss.SSS} %-5level [%thread] %logger{32}[%file:%line] -&gt; %msg%n"/>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${logPattern}</pattern>
<charset class="java.nio.charset.Charset">utf8</charset>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${logpath}/application.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<FileNamePattern>${logpath}/application_%d{yyyy-MM-dd}.log</FileNamePattern>
<maxHistory>10</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${logPattern}</pattern>
</encoder>
</appender>
<!-- 需要记录日志的包 -->
<logger name="cn.com.duiba" level="INFO"/>
<logger name="{artifactId}" level="INFO"/>
<root level="WARN">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</included>
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<include resource="logback/default.xml" />
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
</beans>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="mapUnderscoreToCamelCase" value="true" />
</settings>
</configuration>
\ No newline at end of file
buildscript {
ext {
springBootVersion = '1.5.8.RELEASE'
}
repositories {
mavenLocal()
maven { url "http://nexus.dui88.com:8081/nexus/content/groups/public/" }
maven { url "https://plugins.gradle.org/m2/" } //sonarqube
maven { url 'http://repo.spring.io/plugins-release' }
mavenCentral()
}
dependencies {
classpath "io.spring.gradle:dependency-management-plugin:0.6.1.RELEASE"
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.5' //sonarqube
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
classpath 'org.springframework.build.gradle:propdeps-plugin:0.0.7'
}
}
apply plugin: 'org.sonarqube'
allprojects {
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: "io.spring.dependency-management"
apply plugin: 'propdeps'
test{
ignoreFailures = true
}
group = '{groupId}'
version = '0.0.1-SNAPSHOT'
}
subprojects {
sourceCompatibility = 1.8
targetCompatibility = 1.8
configurations{
all*.exclude group: 'log4j', module:'log4j'
all*.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
all*.exclude group: 'javax.servlet', module: 'servlet-api' //servlet 2.5
}
dependencyManagement {
dependencies {
imports {
mavenBom 'cn.com.duiba.boot:spring-boot-ext-dependencies:1.2.72'
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Dalston.SR4'
}
dependency 'cn.com.duiba:wolf:2.2.7'
dependency 'com.alibaba:fastjson:1.2.29'
dependency 'mysql:mysql-connector-java:5.1.9'
dependency 'javax.validation:validation-api:1.1.0.Final'
}
}
repositories {
mavenLocal()
maven { url "http://nexus.dui88.com:8081/nexus/content/groups/public/" }
mavenCentral()
}
uploadArchives {
repositories {
mavenDeployer {
snapshotRepository(url: "http://nexus.dui88.com:8081/nexus/content/repositories/snapshots/") {
authentication(userName: "admin", password: "admin123")
}
repository(url: "http://nexus.dui88.com:8081/nexus/content/repositories/releases/") {
authentication(userName: "admin", password: "admin123")
}
pom.project {
name project.name
packaging 'jar'
description project.name
url 'www.duiba.com.cn'
scm {
url ''
connection ''
developerConnection ''
}
licenses {
license {
name 'No License'
url 'http://www.duiba.com.cn'
distribution 'repo'
}
}
developers {
developer {
id 'xuhengfei'
name 'Hengfei Xu'
}
}
}
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
task listJars(description: 'Display all compile jars.') << {
configurations.compile.each { File file -> println file.name }
}
}
rootProject.name = '{artifactId}'
include ':{artifactId}-biz'
include ':{artifactId}-api'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment