学习springboot时使用的一些配置。
application.yml
spring: profiles: active: dev #数据库配置 datasource: driver-class-name: com.mysql.jdbc.Driver url: jdbc:mysql://127.0.0.1:3306/yourDatabaseName?useSSL=true&serverTimezone=UTC username: root password: yourDatabasePswd thymeleaf: # 这个是配置模板路径的,默认是templates prefix: classpath:/templates/ suffix: .html # 模板的模式 #spring.thymeleaf.mode的默认值是HTML5,其实是一个很严格的检查,改为LEGACYHTML5可以得到一个可能更友好亲切的格式要求。 mode: LEGACYHTML5 encoding: UTF-8 # 这个开发配置为false,避免改了模板还要重启服务器 cache: false content-type: text/html enabled: true mvc: static-path-pattern: /** resources: static-locations: classpath:/static/ # 设置上传文件的最大值 http: multipart: max-file-size: 20MB max-request-size: 20MB # 启用热发布 devtools: livereload: enabled: true # 配置文件的位置和名称 config: location: classpath:/config/ #这也是默认配置 name: application # REDIS (RedisProperties) redis: database: 0 # Redis数据库索引(默认为0) host: 127.0.0.1 # Redis服务器地址 port: 6379 # Redis服务器连接端口 password: # Redis服务器连接密码(默认为空) pool: max-active: 8 # 连接池最大连接数(使用负值表示没有限制) max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制) max-idle: 8 # 连接池中的最大空闲连接 min-idle: 0 # 连接池中的最小空闲连接 timeout: 0 # 连接超时时间(毫秒) # 重置banner的位置 banner: location: classpath:config/banner.txt # 自定义常量 application: version: 0.0.1-SNAPSHOT formatted-version: (v0.0.1-SNAPSHOT)application-dev.yml
server: port: 8080 context-path: /hy-web mybatis: mapper-locations: classpath:mapper/*Mapper.xml config-location: classpath:config/mybatis-config.xml spring: rabbitmq: # RabbitMQ配置 host: 127.0.0.1 port: 5672 username: name password: pswd data: #连接认证mongodb mongodb: uri: mongodb://127.0.0.1:27017/dbName # uri: mongodb://root:[email protected]:27017/dbName #logging: # config: classpath:config/logback-web.xml #logback配置文件