Commit 8d4452f8 authored by 郭燕飞's avatar 郭燕飞 💬

web模板

parent c123858b
.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}'
apply plugin: 'org.sonarqube'
buildscript {
ext {
springBootVersion = '1.5.9.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: 'maven'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: "io.spring.dependency-management"
apply plugin: 'org.springframework.boot'
apply plugin: 'propdeps'
test {
ignoreFailures = true
}
group = '{groupId}'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
targetCompatibility = 1.8
jar {
baseName = '{artifactId}'
version = ''
}
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
}
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()
}
dependencyManagement {
dependencies {
imports {
mavenBom 'cn.com.duiba.boot:spring-boot-ext-dependencies:1.2.72'
mavenBom "org.springframework.boot:spring-boot-dependencies:${springBootVersion}"
mavenBom 'org.springframework.cloud:spring-cloud-dependencies:Edgware.RELEASE'
}
}
}
dependencies {
compile 'cn.com.duiba.boot:spring-boot-starter-perftest'
compile 'cn.com.duiba.boot:spring-boot-starter-cat'
compile 'cn.com.duiba.boot:spring-boot-starter-xss'
compile 'org.springframework.boot:spring-boot-starter-web'
compile 'org.springframework.boot:spring-boot-starter-actuator'
compile 'org.springframework.boot:spring-boot-starter-freemarker'
compile 'org.springframework.cloud:spring-cloud-starter-config'
compile 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
compile 'org.springframework.cloud:spring-cloud-starter-netflix-hystrix'
compile 'org.springframework.cloud:spring-cloud-starter-netflix-ribbon'
compile 'org.springframework.cloud:spring-cloud-starter-openfeign'
compile 'javax.validation:validation-api:1.1.0.Final'
compile 'io.springfox:springfox-swagger-ui:2.5.0'
compile 'io.springfox:springfox-swagger2:2.5.0'
compile 'com.google.guava:guava:18.0'
compile 'com.alibaba:fastjson:1.2.29'
testCompile 'org.springframework.boot:spring-boot-starter-test'
}
install {//
enabled = false
}
uploadArchives {//
enabled = false
}
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 listJars(description: 'Display all compile jars.') << {
configurations.compile.each { File file -> println file.name }
}
rootProject.name = '{artifactId}'
package {groupId}.{artifactIdPackage};
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;
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
@EnableDuibaFeignClients(basePackages = { "{groupId}" })
public class Application {
public static void main(String[] args) {
SpringApplication sa = new SpringApplication(Application.class);
sa.run(args);
}
}
package {groupId}.{artifactIdPackage}.config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Value("${{artifactIdPackage}.swagger.enable}")
private Boolean swaggerEnable;
/**
* swaggger配置方法
*/
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
.enable(swaggerEnable)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.basePackage("{groupId}"))
.paths(PathSelectors.any())
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("{artifactId}")
.description("{artifactId}")
.termsOfServiceUrl("")
.version("1.0")
.build();
}
}
#tomcat
server.port=1112
server.tomcat.access-log-enabled=false
server.tomcat.uri-encoding=UTF-8
#logging
logging.path=${user.home}/logs/{artifactId}
#swagger
{artifactIdPackage}.swagger.enable=true
\ No newline at end of file
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
<?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"?>
<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="{groupId}" level="INFO"/>
<root level="WARN">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</included>
package {groupId}.{artifactIdPackage};
import org.junit.runner.RunWith;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = Application.class)
@AutoConfigureMockMvc
public abstract class BaseTest {
}
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