Browse Source

init

master
yasaka 7 years ago
commit
777d06c630
  1. 27
      .gitignore
  2. 31
      build.gradle
  3. 27
      sc-config/.gitignore
  4. 43
      sc-config/build.gradle
  5. 18
      sc-config/src/main/java/com/trgis/sb2sc/Sb2scConfigApplication.java
  6. 26
      sc-config/src/main/resources/application.yml
  7. 16
      sc-config/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java
  8. 27
      sc-eureka/.gitignore
  9. 41
      sc-eureka/build.gradle
  10. 14
      sc-eureka/src/main/java/com/trgis/sb2sc/Sb2scEurekaApplication.java
  11. 24
      sc-eureka/src/main/resources/application.yml
  12. 16
      sc-eureka/src/test/java/com/trgis/sb2sc/Sb2scApplicationTests.java
  13. 2
      settings.gradle

27
.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/

31
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'
}
}

27
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/

43
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}"
}
}

18
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);
}
}

26
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

16
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() {
}
}

27
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/

41
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}"
}
}

14
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);
}
}

24
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

16
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() {
}
}

2
settings.gradle

@ -0,0 +1,2 @@
rootProject.name = 'sb2sc'
include('sc-eureka','sc-config')
Loading…
Cancel
Save