# 服务器配置 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 # 令牌前缀