From 591fed8885637d37024521d2f74d78f2e2189b3d Mon Sep 17 00:00:00 2001 From: Qing Date: Sun, 18 Feb 2024 15:57:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20auth=E6=9C=8D=E5=8A=A1=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E5=88=B0nacos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/com/landaiqing/AppTest.java | 38 ------- .../src/test/java/com/landaiqing/AppTest.java | 38 ------- .../src/test/java/com/landaiqing/AppTest.java | 38 ------- jc-club-auth/jc-club-auth-starter/pom.xml | 12 +++ .../src/main/resources/bootstrap.yml | 17 +++ jc-club-auth/pom.xml | 40 +++++-- jc-club-gateway/pom.xml | 101 +++++++++++++++++- .../src/main/java/com/landaiqing/App.java | 13 --- .../club/gateway/GatewayApplication.java | 19 ++++ .../src/main/resources/application.yml | 24 +++++ .../src/main/resources/bootstrap.yml | 17 +++ .../src/test/java/com/landaiqing/AppTest.java | 38 ------- .../oss/adapter/AliStorageAdapter.java | 6 +- .../src/main/resources/application.yml | 2 +- 14 files changed, 223 insertions(+), 180 deletions(-) delete mode 100644 jc-club-auth/jc-club-auth-common/src/test/java/com/landaiqing/AppTest.java delete mode 100644 jc-club-auth/jc-club-auth-domain/src/test/java/com/landaiqing/AppTest.java delete mode 100644 jc-club-auth/jc-club-auth-infra/src/test/java/com/landaiqing/AppTest.java create mode 100644 jc-club-auth/jc-club-auth-starter/src/main/resources/bootstrap.yml delete mode 100644 jc-club-gateway/src/main/java/com/landaiqing/App.java create mode 100644 jc-club-gateway/src/main/java/com/landaiqing/club/gateway/GatewayApplication.java create mode 100644 jc-club-gateway/src/main/resources/application.yml create mode 100644 jc-club-gateway/src/main/resources/bootstrap.yml delete mode 100644 jc-club-gateway/src/test/java/com/landaiqing/AppTest.java diff --git a/jc-club-auth/jc-club-auth-common/src/test/java/com/landaiqing/AppTest.java b/jc-club-auth/jc-club-auth-common/src/test/java/com/landaiqing/AppTest.java deleted file mode 100644 index 908567a..0000000 --- a/jc-club-auth/jc-club-auth-common/src/test/java/com/landaiqing/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.landaiqing; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/jc-club-auth/jc-club-auth-domain/src/test/java/com/landaiqing/AppTest.java b/jc-club-auth/jc-club-auth-domain/src/test/java/com/landaiqing/AppTest.java deleted file mode 100644 index 908567a..0000000 --- a/jc-club-auth/jc-club-auth-domain/src/test/java/com/landaiqing/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.landaiqing; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/jc-club-auth/jc-club-auth-infra/src/test/java/com/landaiqing/AppTest.java b/jc-club-auth/jc-club-auth-infra/src/test/java/com/landaiqing/AppTest.java deleted file mode 100644 index 908567a..0000000 --- a/jc-club-auth/jc-club-auth-infra/src/test/java/com/landaiqing/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.landaiqing; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/jc-club-auth/jc-club-auth-starter/pom.xml b/jc-club-auth/jc-club-auth-starter/pom.xml index be2c759..349962f 100644 --- a/jc-club-auth/jc-club-auth-starter/pom.xml +++ b/jc-club-auth/jc-club-auth-starter/pom.xml @@ -46,6 +46,18 @@ jc-club-auth-infra 1.0-SNAPSHOT + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + org.springframework.cloud + spring-cloud-starter-bootstrap + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + diff --git a/jc-club-auth/jc-club-auth-starter/src/main/resources/bootstrap.yml b/jc-club-auth/jc-club-auth-starter/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..afe7c7a --- /dev/null +++ b/jc-club-auth/jc-club-auth-starter/src/main/resources/bootstrap.yml @@ -0,0 +1,17 @@ +spring: + application: + name: jc-club-auth + profiles: + active: dev + cloud: + nacos: + config: + server-addr: 116.196.80.239:8848 + prefix: ${spring.application.name} + group: DEFAULT_GROUP + namespace: + file-extension: yaml + discovery: + enabled: true + server-addr: 116.196.80.239:8848 + diff --git a/jc-club-auth/pom.xml b/jc-club-auth/pom.xml index ef2a1b4..76e6cb0 100644 --- a/jc-club-auth/pom.xml +++ b/jc-club-auth/pom.xml @@ -19,15 +19,39 @@ + 8 + 8 + 1.8 UTF-8 + UTF-8 + 2.4.2 + 2021.1 + 2020.0.6 - - - junit - junit - 3.8.1 - test - - + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${spring-cloud-alibaba.version} + pom + import + + + diff --git a/jc-club-gateway/pom.xml b/jc-club-gateway/pom.xml index d8fefb8..6cb9f29 100644 --- a/jc-club-gateway/pom.xml +++ b/jc-club-gateway/pom.xml @@ -11,15 +11,108 @@ http://maven.apache.org + 8 + 8 + 1.8 UTF-8 + UTF-8 + 2.4.2 + 2021.1 + 2020.0.6 + + - junit - junit - 3.8.1 - test + io.minio + minio + 8.2.0 + + + org.projectlombok + lombok + 1.18.20 + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + org.springframework.cloud + spring-cloud-starter-bootstrap + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + org.springframework.cloud + spring-cloud-starter-gateway + + + org.springframework.cloud + spring-cloud-loadbalancer + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + com.alibaba.cloud + spring-cloud-alibaba-dependencies + ${spring-cloud-alibaba.version} + pom + import + + + + + + ${project.artifactId} + + + + org.springframework.boot + spring-boot-maven-plugin + 2.3.0.RELEASE + + + + repackage + + + + + + + + + + central + aliyun maven + http://maven.aliyun.com/nexus/content/groups/public/ + default + + true + + + true + + + diff --git a/jc-club-gateway/src/main/java/com/landaiqing/App.java b/jc-club-gateway/src/main/java/com/landaiqing/App.java deleted file mode 100644 index e623ea3..0000000 --- a/jc-club-gateway/src/main/java/com/landaiqing/App.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.landaiqing; - -/** - * Hello world! - * - */ -public class App -{ - public static void main( String[] args ) - { - System.out.println( "Hello World!" ); - } -} diff --git a/jc-club-gateway/src/main/java/com/landaiqing/club/gateway/GatewayApplication.java b/jc-club-gateway/src/main/java/com/landaiqing/club/gateway/GatewayApplication.java new file mode 100644 index 0000000..bdb7a84 --- /dev/null +++ b/jc-club-gateway/src/main/java/com/landaiqing/club/gateway/GatewayApplication.java @@ -0,0 +1,19 @@ +package com.landaiqing.club.gateway; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; + +/** + * 网关启动类 + * + * @author: landaiqing + * @date: 2024/2/7 + */ +@SpringBootApplication +@ComponentScan("com.landaiqing") +public class GatewayApplication { + public static void main(String[] args) { + SpringApplication.run(GatewayApplication.class); + } +} diff --git a/jc-club-gateway/src/main/resources/application.yml b/jc-club-gateway/src/main/resources/application.yml new file mode 100644 index 0000000..b46aeb2 --- /dev/null +++ b/jc-club-gateway/src/main/resources/application.yml @@ -0,0 +1,24 @@ +server: + port: 5000 +spring: + cloud: + gateway: + routes: + - id: oss + uri: lb://jc-club-oss + predicates: + - Path=/oss/** + filters: + - StripPrefix=1 + - id: auth + uri: lb://jc-club-auth-dev + predicates: + - Path=/auth/** + filters: + - StripPrefix=1 + - id: subject + uri: lb://jc-club-subject-dev + predicates: + - Path=/subject/** + filters: + - StripPrefix=1 diff --git a/jc-club-gateway/src/main/resources/bootstrap.yml b/jc-club-gateway/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..6708a8e --- /dev/null +++ b/jc-club-gateway/src/main/resources/bootstrap.yml @@ -0,0 +1,17 @@ +spring: + application: + name: jc-club-gateway-dev + profiles: + active: dev + cloud: + nacos: + config: + server-addr: 116.196.80.239:8848 + prefix: ${spring.application.name} + group: DEFAULT_GROUP + namespace: + file-extension: yaml + discovery: + enabled: true + server-addr: 116.196.80.239:8848 + diff --git a/jc-club-gateway/src/test/java/com/landaiqing/AppTest.java b/jc-club-gateway/src/test/java/com/landaiqing/AppTest.java deleted file mode 100644 index 908567a..0000000 --- a/jc-club-gateway/src/test/java/com/landaiqing/AppTest.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.landaiqing; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -/** - * Unit test for simple App. - */ -public class AppTest - extends TestCase -{ - /** - * Create the test case - * - * @param testName name of the test case - */ - public AppTest( String testName ) - { - super( testName ); - } - - /** - * @return the suite of tests being tested - */ - public static Test suite() - { - return new TestSuite( AppTest.class ); - } - - /** - * Rigourous Test :-) - */ - public void testApp() - { - assertTrue( true ); - } -} diff --git a/jc-club-oss/src/main/java/com/landaiqing/oss/adapter/AliStorageAdapter.java b/jc-club-oss/src/main/java/com/landaiqing/oss/adapter/AliStorageAdapter.java index 249125c..48aba29 100644 --- a/jc-club-oss/src/main/java/com/landaiqing/oss/adapter/AliStorageAdapter.java +++ b/jc-club-oss/src/main/java/com/landaiqing/oss/adapter/AliStorageAdapter.java @@ -4,6 +4,7 @@ import com.landaiqing.oss.entity.FileInfo; import org.springframework.web.multipart.MultipartFile; import java.io.InputStream; +import java.util.LinkedList; import java.util.List; /** @@ -28,8 +29,9 @@ public class AliStorageAdapter implements StorageAdapter { @Override public List getAllBucket() { - System.out.println("aliyun"); - return null; + List bucketNameList = new LinkedList<>(); + bucketNameList.add("aliyun"); + return bucketNameList; } @Override diff --git a/jc-club-oss/src/main/resources/application.yml b/jc-club-oss/src/main/resources/application.yml index 359b330..f890f70 100644 --- a/jc-club-oss/src/main/resources/application.yml +++ b/jc-club-oss/src/main/resources/application.yml @@ -1,6 +1,6 @@ server: port: 4000 minio: - url: http://116.196.80.239:9090/ + url: http://116.196.80.239:9000/ accessKey: landaiqing secretKey: LDQ20020618xxx