java_web/stu01/target/classes/application.yml

47 lines
1.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 服务器配置
server:
port: 8080 # 后端端口,与前端代理配置一致
servlet:
context-path: /api # 接口前缀,适配前端跨域代理
# 数据源配置适配MariaDB兼容MySQL驱动
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver # Spring Boot 3.x推荐驱动类
url: jdbc:mysql://localhost:3306/stu01_db?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: stu01 # 自定义数据库用户
password: 123456 # 数据库用户密码
# 跨域配置配合CorsConfig类双重保障
web:
cors:
allowed-origins: http://localhost:5174 # 前端实际端口
allowed-methods: "*"
allowed-headers: "*"
allow-credentials: true
# MyBatis-Plus配置
mybatis-plus:
configuration:
map-underscore-to-camel-case: true # 下划线转驼峰
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 打印SQL日志测试用
global-config:
db-config:
id-type: AUTO # 主键自增
type-aliases-package: top.awinx.stu01.entity # 实体类包扫描
# mapper-locations: classpath:mapper/*.xml # Mapper XML文件扫描
# mybatis:
# mapperLocations: classpath:mapper/*.xml
logging:
level:
top.awinx.stu01.mapper: debug
com.baomidou.mybatisplus: debug
org.mybatis: debug
# JWT自定义配置适配jjwt 0.13.0
jwt:
secret: abcdefghijklmnopqrstuvwxyz123456 # 32位密钥测试用生产需替换
expire: 3600000 # 过期时间1小时毫秒
header: Authorization # 请求头中JWT令牌的key
prefix: Bearer # 令牌前缀