Browse Source

代码优化

叶君翔 3 years ago
parent
commit
2fd6d6dfdc

+ 0 - 6
lb-gateway/pom.xml

@@ -79,12 +79,6 @@
             <artifactId>lombok</artifactId>
         </dependency>
 
-        <!--<dependency>-->
-        <!--<groupId>com.ydd</groupId>-->
-        <!--<artifactId>lb-common</artifactId>-->
-        <!--<version>1.0</version>-->
-        <!--</dependency>-->
-
     </dependencies>
 
     <build>

+ 2 - 1
lb-gateway/src/main/java/com/ydd/gateway/GatewayApplication.java

@@ -2,6 +2,7 @@ package com.ydd.gateway;
 
 import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
 import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 
@@ -13,7 +14,7 @@ import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
  *
  * @author
  */
-@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class, SecurityAutoConfiguration.class })
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class })
 @EnableDiscoveryClient
 public class GatewayApplication {
     public static void main(String[] args) {

+ 7 - 2
lb-gateway/src/main/resources/application.yml

@@ -1,3 +1,8 @@
+# Tomcat
+server:
+  port: 8087
+
+# Spring
 spring:
   cloud:
     gateway:
@@ -12,8 +17,8 @@ spring:
           # uri: http://www.baidu.com/
           predicates:
             #匹配所有请求路径以
-            - Path=/**
-            - Header=citycode,0512
+            - Path=/api/**
+#            - Header=citycode,0512
           filters:
             - Authorize=true
         - id: api-release

+ 17 - 0
lb-gateway/src/main/resources/bootstrap-dev.yml

@@ -0,0 +1,17 @@
+# Spring
+spring:
+  cloud:
+    nacos:
+      discovery:
+      # 服务注册地址
+        server-addr: 153.37.175.42:28848
+        namespace: 217be27b-d59f-4ab7-b59c-473521a05afe
+      config:
+       # 配置中心地址
+        server-addr: 153.37.175.42:28848
+        file-extension: yaml         # 配置文件格式
+      # 共享配置
+        shared-configs[0]:
+          data-id: lb_application-dev.yaml
+          refresh: false
+

+ 16 - 0
lb-gateway/src/main/resources/bootstrap-test.yml

@@ -0,0 +1,16 @@
+# Spring
+spring:
+  cloud:
+    nacos:
+      discovery:
+      # 服务注册地址
+        server-addr: 153.37.175.42:28848
+      config:
+       # 配置中心地址
+        server-addr: 153.37.175.42:28848
+        file-extension: yaml         # 配置文件格式
+      # 共享配置
+        shared-configs[0]:
+          data-id: lb_application-dev.yaml
+          refresh: false
+

+ 1 - 17
lb-gateway/src/main/resources/bootstrap.yml

@@ -1,6 +1,4 @@
-# Tomcat
-server:
-  port: 8087
+
 
 # Spring
 spring:
@@ -8,17 +6,3 @@ spring:
     name: lb-gateway
   profiles:
     active: dev
-  cloud:
-    nacos:
-      discovery:
-      # 服务注册地址
-        server-addr: 153.37.175.42:28848
-      config:
-       # 配置中心地址
-        server-addr: 153.37.175.42:28848
-        file-extension: yaml         # 配置文件格式
-      # 共享配置
-        shared-configs[0]:
-          data-id: lb_application-dev.yaml
-          refresh: false
-

+ 4 - 4
pom.xml

@@ -297,10 +297,10 @@
         </dependency>
 
         <!-- spring security 安全认证 -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.springframework.boot</groupId>-->
+<!--            <artifactId>spring-boot-starter-security</artifactId>-->
+<!--        </dependency>-->
 
         <!-- pagehelper 分页插件 -->
         <dependency>