初始化版本

This commit is contained in:
2025-07-02 02:28:19 +08:00
parent 2a76c7f3e7
commit 332663f7c6
11 changed files with 677 additions and 0 deletions

View File

@ -0,0 +1,71 @@
server:
port: 8088
spring:
application:
name: sczx-service # 微服务名称
http:
encoding:
charset: UTF-8
enabled: true
force: true
mvc:
async:
request-timeout: -1
cloud:
nacos:
discovery:
server-addr: localhost:8848 # Nacos 地址
datasource:
url: jdbc:mysql://115.190.8.52:3306/sczx?useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true
username: sczx_user
password: Sczx123@
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
maximum-pool-size: 10
auto-commit: true
jpa:
hibernate:
ddl-auto: update
show-sql: true
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
lifecycle:
timeout-per-shutdown-phase: 30s # 设置优雅停机时间
management:
endpoints:
web:
exposure:
include: "*" # 暴露所有监控端点
endpoint:
health:
show-details: always
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
hystrix:
enabled: true # 启用 Feign 的 Hystrix 支持
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 10000 # 默认熔断超时时间
springdoc:
swagger-ui:
url: /v3/api-docs
path: /doc.html
packages-to-scan: com.sczx.app.controller # 替换为你的 controller 包路径
debug: true

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--%d表示日期%X表示输出所有,:null表示为空时输出null%level表示日志级别 %thread表示线程名字 %c表示类名 %L表示行号 %n表示换行符-->
<property name="PATTERN"
value="%-12(%d{yyyy-MM-dd HH:mm:ss.SSS}) [%X{EagleEye-TraceID}%X{EagleEye-TraceID-Copy}] %level [%thread] %c[%L] %X{requestId} %msg%n"/>
<property name="LOG_FILE_PATH" value="./logs"/>
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${PATTERN}</pattern>
</encoder>
</appender>
<appender name="INFO_FILE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE_PATH}/${hostname}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<MaxHistory>31</MaxHistory>
</rollingPolicy>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>${PATTERN}</pattern>
</layout>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>DENY</onMatch>
<onMismatch>NEUTRAL</onMismatch>
</filter>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>DENY</onMatch>
<onMismatch>NEUTRAL</onMismatch>
</filter>
</appender>
<appender name="WARN_FILE_APPENDER" class="ch.qos.logback.core.FileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>WARN</level>
</filter>
<file>${LOG_FILE_PATH}/${hostname}/warn.log</file>
<append>true</append>
<encoder>
<pattern>${PATTERN}</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="INFO_FILE_APPENDER"/>
<appender-ref ref="WARN_FILE_APPENDER"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>