Browse Source

sc provider success

master
yasaka 7 years ago
parent
commit
9cf4b6ad26
  1. 2
      sc-config/build.gradle
  2. 1
      sc-config/src/main/java/com/trgis/sb2sc/Sb2scConfigApplication.java
  3. 2
      sc-config/src/main/resources/application.yml
  4. 14
      sc-provider/src/main/java/com/trgis/sb2sc/controller/IndexController.java
  5. 22
      sc-provider/src/main/resources/bootstrap.yml
  6. 2
      settings.gradle

2
sc-config/build.gradle

@ -32,7 +32,7 @@ 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')
compile('org.springframework.boot:spring-boot-starter-actuator')
testCompile('org.springframework.boot:spring-boot-starter-test')
}

1
sc-config/src/main/java/com/trgis/sb2sc/Sb2scConfigApplication.java

@ -8,7 +8,6 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
@EnableConfigServer
@EnableDiscoveryClient
@EnableEurekaClient
@SpringBootApplication
public class Sb2scConfigApplication {

2
sc-config/src/main/resources/application.yml

@ -21,7 +21,7 @@ eureka:
defaultZone: http://root:booszy@localhost:8761/eureka/
instance:
prefer-ip-address: true
# instance-id: ${spring.application.name}:${spring.cloud.client.ip_address}:${spring.application.instance_id:${server.port}}
# instance-id: ${spring.application.name}:${spring.cloud.client.ipAddress}:${spring.application.instance_id:${server.port}}
instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
appname: springcloud-config-server

14
sc-provider/src/main/java/com/trgis/sb2sc/controller/IndexController.java

@ -0,0 +1,14 @@
package com.trgis.sb2sc.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController
public class IndexController {
@GetMapping("/helloworld")
public Mono<String> sayHelloWorld() {
return Mono.just("Hello World SC");
}
}

22
sc-provider/src/main/resources/bootstrap.yml

@ -0,0 +1,22 @@
eureka:
client:
service-url:
defaultZone: http://root:booszy@localhost:8761/eureka/
instance:
prefer-ip-address: true
instance-id: ${spring.application.name}:${spring.application.instance_id:${server.port}}
appname: sc-provider
spring:
application:
name: sc-provider
cloud:
config:
discovery:
enabled: true
service-id: springcloud-config-server
fail-fast: true
username: root
password: booszy
profile: csdn

2
settings.gradle

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