From 39c2f1a1c280a76215f185294452f7dba2270ff3 Mon Sep 17 00:00:00 2001 From: tanghc Date: Fri, 23 Aug 2019 09:12:56 +0800 Subject: [PATCH] 2.0 --- doc/docs/files/90100_常见问题.md | 19 ++++----- sop-auth/pom.xml | 26 ++++++++---- .../main/resources/application-dev.properties | 24 +++++++++++ .../src/main/resources/application-dev.yml | 42 ------------------- .../src/main/resources/application.properties | 1 + sop-auth/src/main/resources/application.yml | 3 -- 6 files changed, 50 insertions(+), 65 deletions(-) create mode 100644 sop-auth/src/main/resources/application-dev.properties delete mode 100644 sop-auth/src/main/resources/application-dev.yml create mode 100644 sop-auth/src/main/resources/application.properties delete mode 100644 sop-auth/src/main/resources/application.yml diff --git a/doc/docs/files/90100_常见问题.md b/doc/docs/files/90100_常见问题.md index fc743001..7b5920f2 100644 --- a/doc/docs/files/90100_常见问题.md +++ b/doc/docs/files/90100_常见问题.md @@ -53,11 +53,9 @@ public class ZuulConfig extends AlipayZuulConfiguration { ## 注册到eureka显示hostname,非ip -```yaml -eureka: - instance: - prefer-ip-address: true - instance-id: ${spring.cloud.client.ip-address}:${server.port} +```properties +eureka.instance.prefer-ip-address=true +eureka.instance.instance-id=${spring.cloud.client.ip-address}:${server.port} ``` ```xml @@ -98,10 +96,9 @@ public static class Swagger2 extends SwaggerSupport { yml添加: -```yaml -ribbon: - # https://blog.csdn.net/qq_36872046/article/details/81058045 - # 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。 - # 如果微服务端 处理时间过长,会导致ribbon read超时,解决办法将这个值调大一点 - ReadTimeout: 60000 +```properties +# https://blog.csdn.net/qq_36872046/article/details/81058045 +# 路由转发超时时间,毫秒,默认值1000,详见:RibbonClientConfiguration.DEFAULT_READ_TIMEOUT。 +# 如果微服务端 处理时间过长,会导致ribbon read超时,解决办法将这个值调大一点 +ribbon.ReadTimeout: 60000 ``` \ No newline at end of file diff --git a/sop-auth/pom.xml b/sop-auth/pom.xml index 082c5269..f05332e8 100644 --- a/sop-auth/pom.xml +++ b/sop-auth/pom.xml @@ -28,26 +28,34 @@ sop-service-common 2.0.0-SNAPSHOT + + + org.springframework.cloud - spring-cloud-starter-netflix-eureka-client + spring-cloud-starter-alibaba-nacos-discovery + 0.2.2.RELEASE + + + com.alibaba.nacos + nacos-client + + - org.springframework.cloud - spring-cloud-starter-openfeign + com.alibaba.nacos + nacos-client + 1.1.0 - com.gitee.sop sdk-java 1.0.0-SNAPSHOT - - com.squareup.okhttp3 - okhttp - 3.14.0 - net.oschina.durcframework diff --git a/sop-auth/src/main/resources/application-dev.properties b/sop-auth/src/main/resources/application-dev.properties new file mode 100644 index 00000000..03b6de01 --- /dev/null +++ b/sop-auth/src/main/resources/application-dev.properties @@ -0,0 +1,24 @@ +server.port=8087 +spring.application.name=sop-auth + +# ------- 需要改的配置 ------- +# mysql数据库账号 +mysql.username=root +mysql.password=root + +# nacos地址 +nacos.url=127.0.0.1:8848 + +# ------- 需要改的配置end ------- + +# nacos cloud配置 +spring.cloud.nacos.discovery.server-addr=${nacos.url} + +spring.datasource.driver-class-name=com.mysql.jdbc.Driver +spring.datasource.url=jdbc:mysql://localhost:3306/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull +spring.datasource.username=${mysql.username} +spring.datasource.password=${mysql.password} + +spring.thymeleaf.cache=false + +logging.level.com.gitee=debug diff --git a/sop-auth/src/main/resources/application-dev.yml b/sop-auth/src/main/resources/application-dev.yml deleted file mode 100644 index 128c2dae..00000000 --- a/sop-auth/src/main/resources/application-dev.yml +++ /dev/null @@ -1,42 +0,0 @@ - -server: - port: 8087 - - -# 注册中心 -eureka: - port: 1111 - host: localhost - client: - serviceUrl: - defaultZone: http://${eureka.host}:${eureka.port}/eureka/ - -spring: - application: - name: sop-auth - - cloud: - zookeeper: - connect-string: localhost:2181 - - # 数据源 - datasource: - driver-class-name: com.mysql.jdbc.Driver - url: jdbc:mysql://localhost:3306/sop?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull - username: root - password: root - - thymeleaf: - cache: false - - # redis设置 -# redis: -# host: localhost -# database: 0 - - - -logging: - level: - com: - gitee: debug \ No newline at end of file diff --git a/sop-auth/src/main/resources/application.properties b/sop-auth/src/main/resources/application.properties new file mode 100644 index 00000000..257b3064 --- /dev/null +++ b/sop-auth/src/main/resources/application.properties @@ -0,0 +1 @@ +spring.profiles.active=dev \ No newline at end of file diff --git a/sop-auth/src/main/resources/application.yml b/sop-auth/src/main/resources/application.yml deleted file mode 100644 index caf4dfcd..00000000 --- a/sop-auth/src/main/resources/application.yml +++ /dev/null @@ -1,3 +0,0 @@ -spring: - profiles: - active: dev \ No newline at end of file