diff --git a/pom.xml b/pom.xml index 97b42c9..02e54dc 100644 --- a/pom.xml +++ b/pom.xml @@ -3,20 +3,18 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - org.springframework.boot - spring-boot-starter-parent - 3.5.5 - + com.ai + spring-ai-parent + 1.0.1 - com.ai - spring_ai_app - 1.0.0 - spring_ai_app - spring_ai_app + spring-ai-app + 1.0.1 + spring-ai-app + spring-ai-app + 21 + 21 21 - - 1.0.1 @@ -24,6 +22,16 @@ spring-boot-starter-web + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + org.springframework.boot spring-boot-starter-test @@ -43,66 +51,35 @@ org.springframework.boot spring-boot-starter-data-redis - com.baomidou mybatis-plus-spring-boot3-starter - 3.5.10.1 com.baomidou mybatis-plus-generator - 3.5.5 - mysql mysql-connector-java - 8.0.17 - org.projectlombok lombok true - com.alibaba fastjson - 1.2.83 - org.apache.commons commons-lang3 - 3.18.0 - - - - - org.springframework.ai - spring-ai-bom - ${spring.ai.bom} - pom - import - - - - com.alibaba.cloud.ai - spring-ai-alibaba-bom - 1.0.0.2 - pom - import - - - - diff --git a/src/main/java/com/ai/app/SpringAiAppApplication.java b/src/main/java/com/ai/app/SpringAiAppApplication.java index 43799de..c8bf5f0 100644 --- a/src/main/java/com/ai/app/SpringAiAppApplication.java +++ b/src/main/java/com/ai/app/SpringAiAppApplication.java @@ -3,7 +3,11 @@ package com.ai.app; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; +import org.springframework.transaction.annotation.EnableTransactionManagement; +@EnableDiscoveryClient +@EnableTransactionManagement @SpringBootApplication @MapperScan(basePackages = "com.ai.app.mapper") public class SpringAiAppApplication { diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index e69de29..266b475 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -0,0 +1,18 @@ +# 服务注册配置 +eureka: + instance: + # 设置实例ID + instance-id: ${spring.cloud.client.ip-address}:${server.port}:@project.version@ + # 使用IP进行服务注册 + prefer-ip-address: true + metadata-map: + management: + # 设置健康检查接口的访问路径 + context-path: ${server.servlet.context-path}/actuator + client: + service-url: + # Eureka服务端注册地址,多个地址以逗号分隔 + defaultZone: http://139.224.53.200:8000/register/eureka + # 日志配置 + logging: + config: classpath:env/dev/logback-spring-dev.xml \ No newline at end of file diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml new file mode 100644 index 0000000..f6d19b6 --- /dev/null +++ b/src/main/resources/application-test.yml @@ -0,0 +1,19 @@ +# 服务注册配置 +eureka: + instance: + # 设置实例ID + instance-id: ${eureka.instance.ip-address}:${server.port}:@project.version@ + # 使用IP进行服务注册 + prefer-ip-address: true + ip-address: 139.224.53.200 + metadata-map: + management: + # 设置健康检查接口的访问路径 + context-path: ${server.servlet.context-path}/actuator + client: + service-url: + # Eureka服务端注册地址,多个地址以逗号分隔 + defaultZone: http://139.224.53.200:8000/register/eureka + # 日志配置 + logging: + config: classpath:env/test/logback-spring-test.xml \ No newline at end of file diff --git a/src/main/resources/env/dev/logback-spring-dev.xml b/src/main/resources/env/dev/logback-spring-dev.xml new file mode 100644 index 0000000..2e2b287 --- /dev/null +++ b/src/main/resources/env/dev/logback-spring-dev.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + true + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) --- [%15.15(%thread)] %cyan(%-40.40(%logger{40})) : %msg%n + + UTF-8 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/env/test/logback-spring-test.xml b/src/main/resources/env/test/logback-spring-test.xml new file mode 100644 index 0000000..b1b957f --- /dev/null +++ b/src/main/resources/env/test/logback-spring-test.xml @@ -0,0 +1,52 @@ + + + + + true + logs/info_log.log + true + + ERROR + DENY + ACCEPT + + + logs/%d/info_log.%d.%i.log + 7 + 10GB + 10MB + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%15.15(%thread)] %-40.40(%logger{40}) : %msg%n + UTF-8 + + + + + + true + logs/error_log.log + true + + ERROR + + + logs/%d/error_log.%d.%i.log + 7 + 10GB + 10MB + + + %d{yyyy-MM-dd HH:mm:ss.SSS} %-5level --- [%15.15(%thread)] %-40.40(%logger{40}) : %msg%n + UTF-8 + + + + + + + + + + + \ No newline at end of file