tlias管理系统-配置文件-@ConfigurationProperties配置类对象(硬编码)功能实现

This commit is contained in:
2025-10-13 15:23:39 +08:00
parent 29f56e563c
commit 6b5b025cca
5 changed files with 107 additions and 69 deletions

View File

@@ -1,31 +0,0 @@
# 应用服务 WEB 访问端口
#server.port=8080
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
mybatis.mapper-locations=classpath:mappers/*xml
#指定Mybatis的实体目录
mybatis.type-aliases-package=com.inmind.mybatis.entity
#驱动类名称
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#数据库连接的url
spring.datasource.url=jdbc:mysql://localhost:3306/tlias1
#连接数据库的用户名
spring.datasource.username=root
#连接数据库的密码
spring.datasource.password=1234
#输出mybatis的日志
mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
#开启mybatis的驼峰命名自动映射开关,将a_time ---->aTime
mybatis.configuration.map-underscore-to-camel-case=true
#文件上传大小配置
spring.servlet.multipart.max-file-size= 10MB
spring.servlet.multipart.max-request-size=100MB
#阿里云OSS配置信息
aliyun.oss.endpoint=https://oss-cn-hangzhou.aliyuncs.com
aliyun.oss.bucketName=inmind-test1
aliyun.oss.region=cn-hangzhou

View File

@@ -1,32 +1,29 @@
server:
port: 8080
#mybatis连接四要素
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/tlias1
username: root
password: 1234
servlet:
multipart:
#单个文件上传大小限制10兆
max-file-size: 10MB
#一次请求多个文件上传大小限制100兆
max-request-size: 100MB
#定义对象
user:
name: zhangsan
age: 18
password: 123456
mybatis:
configuration:
#输出mybatis的日志
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#驼峰自动映射
map-underscore-to-camel-case: true
#定义map集合
userMap:
name: zhangsan
age: 18
password: 123456
#定义数组/list/set
hobbys:
- 吃饭
- 睡觉
- 玩手机
#定义对象数组 User[] 定义User对象的list
users:
- name: lisi
age: 20
gender: 1
- name: wangwu
age: 21
gender: 2
- name: zhaoliu
age: 22
gender: 1
#阿里云OSS配置信息
aliyun:
oss:
endpoint: https://oss-cn-hangzhou.aliyuncs.com
bucketName: inmind-test1
region: cn-hangzhou