1. # 应用服务 WEB 访问端口
    2. server:
    3. port: 8080
    4. # 应用名称
    5. spring:
    6. application:
    7. name: SpringBoot-Shiro
    8. #数据库驱动
    9. datasource:
    10. driver-class-name: com.mysql.cj.jdbc.Driver
    11. # 数据源名称
    12. name: defaultDataSource
    13. # 数据库连接地址
    14. url: jdbc:mysql://localhost:3306/mybatis?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8
    15. # 数据库用户名&密码:
    16. username: root
    17. password: root
    18. # 切换数据源为druid
    19. type: com.alibaba.druid.pool.DruidDataSource
    20. #Spring Boot 默认是不注入这些属性值的,需要自己绑定
    21. #druid 数据源专有配置
    22. druid:
    23. # 初始连接数
    24. initial-size: 5
    25. # 最小连接池数量
    26. min-idle: 5
    27. # 最大连接池数量
    28. max-active: 20
    29. # 配置获取连接等待超时的时间
    30. max-wait: 60000
    31. # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
    32. time-between-eviction-runs-millis: 60000
    33. # 配置一个连接在池中最小生存的时间,单位是毫秒
    34. min-evictable-idle-time-millis: 300000
    35. # 配置一个连接在池中最大生存的时间,单位是毫秒
    36. max-evictable-idle-time-millis: 900000
    37. # 配置检测连接是否有效
    38. validation-query: SELECT 1 FROM DUAL
    39. # 空闲时检测配置连接是否有效
    40. test-while-idle: true
    41. test-on-borrow: false
    42. test-on-return: false
    43. # PSCache
    44. pool-prepared-statements: true
    45. # 配置监控统计拦截的filters,stat:监控统计、log4j:日志记录、wall:防御sql注入
    46. # 如果允许时报错 java.lang.ClassNotFoundException: org.apache.log4j.Priority
    47. # 则导入 log4j 依赖即可,Maven 地址:https://mvnrepository.com/artifact/log4j/log4j
    48. filter: stat,wall,log4j
    49. # 每个连接最多缓存多少个SQL
    50. max-pool-prepared-statement-per-connection-size: 20
    51. # 合并多个DruidDataSource的监控数据
    52. use-global-data-source-stat: true
    53. # 连接属性。比如设置一些连接池统计方面的配置。
    54. connection-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500
    55. # Thymeleaf (ThymeleafAutoConfiguration)
    56. # 开启模板缓存(默认值: true )
    57. thymeleaf:
    58. cache: true
    59. # 检查模板是否存在,然后再呈现
    60. check-template: true
    61. # 检查模板位置是否正确(默认值 :true )
    62. check-template-location: true
    63. #Content-Type 的值(默认值: text/html )
    64. servlet:
    65. content-type: text/html
    66. # 开启 MVC Thymeleaf 视图解析(默认值: true )
    67. enabled: true
    68. # 模板编码
    69. encoding: UTF-8
    70. # 要被排除在解析之外的视图名称列表,⽤逗号分隔
    71. excluded-view-names:
    72. # 要运⽤于模板之上的模板模式。另⻅ StandardTemplate-ModeHandlers( 默认值: HTML5)
    73. mode: HTML5
    74. # 在构建 URL 时添加到视图名称前的前缀(默认值: classpath:/templates/ )
    75. prefix: classpath:/templates/
    76. # 在构建 URL 时添加到视图名称后的后缀(默认值: .html )
    77. suffix: .html
    78. #下面这些内容是为了让MyBatis映射
    79. #指定Mybatis的Mapper文件
    80. mybatis:
    81. mapper-locations: classpath:mappers/*.xml
    82. #指定Mybatis的实体目录
    83. type-aliases-package: com.yafnds.springbootshiro.pojo
    84. #开启驼峰命名
    85. configuration:
    86. map-underscore-to-camel-case: true