fix: 运行时验证修复

- Auth服务: 添加RestTemplate Bean
- 所有服务: JDBC URL characterEncoding=utf8mb4 -> utf8
- Gateway: CORS配置allowedOrigins -> allowedOriginPatterns
- 所有服务pom.xml: 添加spring-boot-maven-plugin repackage execution
This commit is contained in:
jiao 2026-05-13 15:48:44 +08:00
parent 5a4d33e845
commit c78ff4fdea
19 changed files with 49 additions and 14 deletions

View File

@ -27,6 +27,13 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -6,7 +6,7 @@ spring:
name: analytics-service name: analytics-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -18,7 +18,7 @@
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -6,7 +6,7 @@ spring:
name: archive-service name: archive-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -46,6 +46,13 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -2,6 +2,8 @@ package com.artedu.auth;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
/** /**
* 认证授权服务启动类 * 认证授权服务启动类
@ -9,6 +11,11 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(scanBasePackages = {"com.artedu.auth", "com.artedu.common"}) @SpringBootApplication(scanBasePackages = {"com.artedu.auth", "com.artedu.common"})
public class AuthServiceApplication { public class AuthServiceApplication {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AuthServiceApplication.class, args); SpringApplication.run(AuthServiceApplication.class, args);
} }

View File

@ -6,7 +6,7 @@ spring:
name: auth-service name: auth-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -18,7 +18,7 @@
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -6,7 +6,7 @@ spring:
name: conversation-service name: conversation-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -22,6 +22,13 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -42,7 +42,7 @@ spring:
globalcors: globalcors:
cors-configurations: cors-configurations:
'[/**]': '[/**]':
allowedOrigins: "*" allowedOriginPatterns: "*"
allowedMethods: "*" allowedMethods: "*"
allowedHeaders: "*" allowedHeaders: "*"
allowCredentials: true allowCredentials: true

View File

@ -17,7 +17,7 @@
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -6,7 +6,7 @@ spring:
name: generation-service name: generation-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -17,7 +17,7 @@
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -6,7 +6,7 @@ spring:
name: intent-service name: intent-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -27,6 +27,13 @@
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</build> </build>

View File

@ -6,7 +6,7 @@ spring:
name: kb-admin-service name: kb-admin-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis:

View File

@ -18,7 +18,7 @@
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin> <plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>repackage</goal></goals></execution></executions></plugin>
</plugins> </plugins>
</build> </build>
</project> </project>

View File

@ -6,7 +6,7 @@ spring:
name: recommendation-service name: recommendation-service
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8mb4&serverTimezone=Asia/Shanghai&useSSL=false url: jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:ai_assistant}?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false
username: ${MYSQL_USERNAME:root} username: ${MYSQL_USERNAME:root}
password: ${MYSQL_PASSWORD:root} password: ${MYSQL_PASSWORD:root}
redis: redis: