| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- # ============================================
- # Snapshot 后端服务配置模板
- # ============================================
- # 使用说明:
- # 1. 复制此文件到 src/main/resources/application.properties
- # 2. 修改数据库密码等敏感信息
- # 3. 不要将包含真实密码的配置文件提交到Git
- # ============================================
- # 服务器配置
- server.port=7626
- server.servlet.context-path=/
- server.tomcat.uri-encoding=UTF-8
- server.tomcat.max-swallow-size=500MB
- # ============================================
- # 连接超时配置(解决上传卡顿问题)
- # ============================================
- # Tomcat连接超时(毫秒)- 30分钟,适应慢速网络
- server.tomcat.connection-timeout=1800000
- # Tomcat keep-alive超时(毫秒)- 30分钟
- server.tomcat.keep-alive-timeout=1800000
- # 最大线程数(增加并发处理能力)
- server.tomcat.max-threads=200
- server.tomcat.min-spare-threads=10
- # 最大连接数
- server.tomcat.max-connections=8192
- # 接受队列大小
- server.tomcat.accept-count=100
- # ============================================
- # 文件上传配置
- # ============================================
- spring.servlet.multipart.enabled=true
- spring.servlet.multipart.max-file-size=500MB
- spring.servlet.multipart.max-request-size=500MB
- spring.servlet.multipart.file-size-threshold=10MB
- # ============================================
- # 数据源配置
- # ============================================
- spring.datasource.url=jdbc:mysql://localhost:3306/snapshot?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
- spring.datasource.username=root
- # ⚠️ 请修改为你的MySQL密码
- spring.datasource.password=your_mysql_password_here
- spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
- # 激活开发环境配置(启用自动数据库初始化)
- spring.profiles.active=dev
- # ============================================
- # HikariCP 连接池配置
- # ============================================
- spring.datasource.hikari.connection-timeout=30000
- spring.datasource.hikari.maximum-pool-size=10
- spring.datasource.hikari.minimum-idle=5
- spring.datasource.hikari.idle-timeout=600000
- spring.datasource.hikari.max-lifetime=1800000
- spring.datasource.hikari.pool-name=SnapshotHikariCP
- # ============================================
- # MyBatis 配置
- # ============================================
- mybatis.mapper-locations=classpath:mapper/*.xml
- mybatis.type-aliases-package=com.snapshot.entity
- mybatis.configuration.map-underscore-to-camel-case=true
- mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
- # ============================================
- # JSON序列化配置
- # ============================================
- spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
- spring.jackson.time-zone=Asia/Shanghai
- spring.jackson.serialization.write-dates-as-timestamps=false
- spring.jackson.default-property-inclusion=non_null
- # ============================================
- # 日志配置
- # ============================================
- logging.level.root=INFO
- logging.level.com.snapshot=DEBUG
- logging.level.com.snapshot.mapper=DEBUG
- logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
- logging.file.name=logs/snapshot.log
- logging.file.max-size=10MB
- logging.file.max-history=30
- # ============================================
- # 应用自定义配置
- # ============================================
- # 文件存储路径
- app.file.upload-dir=./uploads
- app.file.max-size=524288000
- app.file.max-count=10
- # ID生成器配置
- app.id.length=8
- app.id.charset=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
- # 过期清理任务配置
- app.cleanup.cron=0 0 */2 * * ?
- app.cleanup.enabled=true
- # ============================================
- # 一体化部署配置
- # ============================================
- # 服务访问地址配置(用于生成分享链接)
- # 格式:协议://域名:端口,如 http://snapshot.lemonai.online:7626
- # 如果不配置,则使用请求头中的Host和协议
- app.server.base-url=http://localhost:7626
- # ============================================
- # CORS配置(一体化部署后允许同源访问)
- # ============================================
- app.cors.allowed-origins=http://localhost:7626,http://127.0.0.1:7626
- app.cors.allowed-methods=GET,POST,PUT,DELETE,OPTIONS,PATCH
- app.cors.allowed-headers=*
- app.cors.allow-credentials=true
- app.cors.max-age=3600
- # ============================================
- # 静态资源配置
- # ============================================
- # 前端构建文件放置在 src/main/resources/static/ 目录
- # Spring Boot会自动提供静态资源服务
- app.static.resource.location=classpath:/static/
|