Browse Source

zuul测试通过

master
yirenyishi 6 years ago
parent
commit
41f757cb6e
  1. 27
      sc-zuul/.gitignore
  2. 42
      sc-zuul/build.gradle
  3. 18
      sc-zuul/src/main/java/com/trgis/sb2sc/Sb2scZuulApplication.java
  4. 38
      sc-zuul/src/main/resources/application.yml
  5. 22
      sc-zuul/src/main/resources/bootstrap.yml
  6. 2
      settings.gradle

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

42
sc-zuul/build.gradle

@ -0,0 +1,42 @@
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-client')
compile('org.springframework.cloud:spring-cloud-starter-config')
compile('org.springframework.cloud:spring-cloud-starter-netflix-zuul')
compile('org.springframework.boot:spring-boot-starter-actuator')
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}

18
sc-zuul/src/main/java/com/trgis/sb2sc/Sb2scZuulApplication.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.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
@EnableDiscoveryClient
@SpringBootApplication
@EnableZuulProxy
@RefreshScope
public class Sb2scZuulApplication {
public static void main(String[] args) {
SpringApplication.run(Sb2scZuulApplication.class, args);
}
}

38
sc-zuul/src/main/resources/application.yml

@ -0,0 +1,38 @@
server:
port: 8400
spring:
profiles:
active: csdn
zuul:
routes:
sc-consumer: /consumer/**
sc-provider: /provider/**
#hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds: 80000
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 80000
# keycloak:
# realm : springcloud-zuul
# auth-server-url : http://127.0.0.1:8080/auth
# ssl-required : external
# resource : springcloud-zuul
# credentials.secret : 11111111-1111-1111-1111-111111111111
# use-resource-role-mappings : true
# enable-basic-auth: true
# securityConstraints:
# - authRoles: user
# securityCollections:
# - patterns: /provider/user/info
# - authRoles: users
# securityCollections:
# - patterns: /consumer/user/list
# - authRoles: test
# securityCollections:
# - patterns: /provider/user/list
# hystrix.command.default.execution.timeout.enabled: false

22
sc-zuul/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-zuul
spring:
application:
name: sc-zuul
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','sc-provider','sc-consumer')
include('sc-eureka','sc-config','sc-provider','sc-consumer','sc-zuul')
Loading…
Cancel
Save