commit 777d06c63008bb32d0c2b5d70debedc7c3e6951c Author: yasaka Date: Fri Jun 22 08:52:03 2018 +0800 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b1babb --- /dev/null +++ b/.gitignore @@ -0,0 +1,27 @@ +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +/out/ + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..3bcb1ae --- /dev/null +++ b/build.gradle @@ -0,0 +1,31 @@ +subprojects { + buildscript { + ext { + springBootVersion = '2.0.3.RELEASE' + } + repositories { + maven { url "http://maven.aliyun.com/nexus/content/groups/public/" } + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + } + } + + + apply plugin: 'java' + apply plugin: 'idea' +// apply plugin: 'org.springframework.boot' +// apply plugin: 'io.spring.dependency-management' + + sourceCompatibility = 1.8 + repositories { + maven { url "http://maven.aliyun.com/nexus/content/groups/public/" } + mavenCentral() + } + + ext { + springCloudVersion = 'Finchley.RELEASE' + } + +} diff --git a/sc-config/.gitignore b/sc-config/.gitignore new file mode 100644 index 0000000..2b1babb --- /dev/null +++ b/sc-config/.gitignore @@ -0,0 +1,27 @@ +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +/out/ + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/sc-config/build.gradle b/sc-config/build.gradle new file mode 100644 index 0000000..4ef7d56 --- /dev/null +++ b/sc-config/build.gradle @@ -0,0 +1,43 @@ +buildscript { + ext { + springBootVersion = '2.0.3.RELEASE' + } + repositories { + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + } +} + +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +group = 'com.trgis' +version = '0.0.1-SNAPSHOT' +sourceCompatibility = 1.8 + +repositories { + mavenCentral() +} + + +ext { + springCloudVersion = 'Finchley.RELEASE' +} + +dependencies { + compile('org.springframework.cloud:spring-cloud-config-server') + compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-client') + compile('org.springframework.boot:spring-boot-starter-security') + compile('org.springframework.boot:spring-boot-actuator') + testCompile('org.springframework.boot:spring-boot-starter-test') +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" + } +} diff --git a/sc-config/src/main/java/com/trgis/sb2sc/Sb2scConfigApplication.java b/sc-config/src/main/java/com/trgis/sb2sc/Sb2scConfigApplication.java new file mode 100644 index 0000000..fa14886 --- /dev/null +++ b/sc-config/src/main/java/com/trgis/sb2sc/Sb2scConfigApplication.java @@ -0,0 +1,18 @@ +package com.trgis.sb2sc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.cloud.config.server.EnableConfigServer; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + +@EnableConfigServer +@EnableDiscoveryClient +@EnableEurekaClient +@SpringBootApplication +public class Sb2scConfigApplication { + + public static void main(String[] args) { + SpringApplication.run(Sb2scConfigApplication.class, args); + } +} diff --git a/sc-config/src/main/resources/application.yml b/sc-config/src/main/resources/application.yml new file mode 100644 index 0000000..375e1c3 --- /dev/null +++ b/sc-config/src/main/resources/application.yml @@ -0,0 +1,26 @@ +server: + port: 8800 +spring: +# security: +# basic: +# enabled: true +# user: +# name: root +# password: booszy + application: + name: springcloud-config-server + cloud: + config: + server: + git: + uri: https://git.coding.net/yirenyishi/springcloud-config-profile + searchPaths: '{application}' +eureka: + client: + service-url: + defaultZone: http://root:booszy@localhost:8761/eureka/ + instance: + prefer-ip-address: true + instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}} + appname: springcloud-config-server + diff --git a/sc-config/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java b/sc-config/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java new file mode 100644 index 0000000..1d2cdcf --- /dev/null +++ b/sc-config/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java @@ -0,0 +1,16 @@ +package com.trgis.sb2sc; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class Sb2scApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/sc-eureka/.gitignore b/sc-eureka/.gitignore new file mode 100644 index 0000000..2b1babb --- /dev/null +++ b/sc-eureka/.gitignore @@ -0,0 +1,27 @@ +.gradle +/build/ +!gradle/wrapper/gradle-wrapper.jar + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr +/out/ + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ \ No newline at end of file diff --git a/sc-eureka/build.gradle b/sc-eureka/build.gradle new file mode 100644 index 0000000..670b47d --- /dev/null +++ b/sc-eureka/build.gradle @@ -0,0 +1,41 @@ +buildscript { + ext { + springBootVersion = '2.0.3.RELEASE' + } + repositories { + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") + } +} + +apply plugin: 'java' +apply plugin: 'eclipse' +apply plugin: 'org.springframework.boot' +apply plugin: 'io.spring.dependency-management' + +group = 'com.trgis' +version = '0.0.1-SNAPSHOT' +sourceCompatibility = 1.8 + +repositories { + mavenCentral() +} + + +ext { + springCloudVersion = 'Finchley.RELEASE' +} + +dependencies { + compile('org.springframework.cloud:spring-cloud-starter-netflix-eureka-server') + compile('org.springframework.boot:spring-boot-starter-security') + testCompile('org.springframework.boot:spring-boot-starter-test') +} + +dependencyManagement { + imports { + mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" + } +} diff --git a/sc-eureka/src/main/java/com/trgis/sb2sc/Sb2scEurekaApplication.java b/sc-eureka/src/main/java/com/trgis/sb2sc/Sb2scEurekaApplication.java new file mode 100644 index 0000000..eb4e7d0 --- /dev/null +++ b/sc-eureka/src/main/java/com/trgis/sb2sc/Sb2scEurekaApplication.java @@ -0,0 +1,14 @@ +package com.trgis.sb2sc; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; + +@EnableEurekaServer +@SpringBootApplication +public class Sb2scEurekaApplication { + + public static void main(String[] args) { + SpringApplication.run(Sb2scEurekaApplication.class, args); + } +} diff --git a/sc-eureka/src/main/resources/application.yml b/sc-eureka/src/main/resources/application.yml new file mode 100644 index 0000000..f17c41a --- /dev/null +++ b/sc-eureka/src/main/resources/application.yml @@ -0,0 +1,24 @@ +server: + port: 8761 +eureka: + datacenter: trmap + environment: product + server: + # 关闭自我保护 + enable-self-preservation: false + # 清理服务器 + eviction-interval-timer-in-ms: 30000 + client: + healthcheck: + enabled: true + service-url: + defaultZone: http://root:booszy@localhost:8761/eureka/ + register-with-eureka: false + fetch-registry: false +spring: + security: + basic: + enabled: true + user: + name: root + password: booszy \ No newline at end of file diff --git a/sc-eureka/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java b/sc-eureka/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java new file mode 100644 index 0000000..1d2cdcf --- /dev/null +++ b/sc-eureka/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java @@ -0,0 +1,16 @@ +package com.trgis.sb2sc; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest +public class Sb2scApplicationTests { + + @Test + public void contextLoads() { + } + +} diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..c5727ac --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'sb2sc' +include('sc-eureka','sc-config') \ No newline at end of file