spring-boot 中application.properties的各种配置
Posted 英俊聪明
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了spring-boot 中application.properties的各种配置相关的知识,希望对你有一定的参考价值。
########################################################
###datasource connect mysql
########################################################
spring.datasource.url = jdbc:mysql://localhost:3306/springboot_db
spring.datasource.username = root
spring.datasource.password = 521314
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.datasource.max-active=20
spring.datasource.max-idle=8
spring.datasource.min-idle=8
spring.datasource.initial-size=10
########################################################
### server
########################################################
#server.port=8080
#server.address= # bind to a specific NIC
#server.session-timeout= # session timeout in seconds
#the context path, defaults to ‘/‘
#server.context-path=/spring-boot
#server.servlet-path= # the servlet path, defaults to ‘/‘
#server.tomcat.access-log-pattern= # log pattern of the access log
#server.tomcat.access-log-enabled=false # is access logging enabled
#server.tomcat.protocol-header=x-forwarded-proto # ssl forward headers
#server.tomcat.remote-ip-header=x-forwarded-for
#server.tomcat.basedir=/tmp # base dir (usually not needed, defaults to tmp)
#server.tomcat.background-processor-delay=30; # in seconds
#server.tomcat.max-threads = 0 # number of threads in protocol handler
#server.tomcat.uri-encoding = UTF-8 # character encoding to use for URL decoding
########################################################
### Java Persistence Api
########################################################
# Specify the DBMS
spring.jpa.database = MYSQL
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming strategy
#[org.hibernate.cfg.ImprovedNamingStrategy #org.hibernate.cfg.DefaultNamingStrategy]
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
# stripped before adding them to the entity manager)
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
########################################################
###THYMELEAF (ThymeleafAutoConfiguration) 引擎模版thymeleaf
########################################################
#前缀 在classpath路径下的templates目录中有.html文件
#spring.thymeleaf.prefix=classpath:/templates/
#后缀
spring.thymeleaf.suffix=.html
#spring.thymeleaf.mode=LEGACYHTML5
#spring.thymeleaf.mode=HTML5
#spring.thymeleaf.encoding=UTF-8
# ;charset=<encoding> is added
#spring.thymeleaf.content-type=text/html
# set to false for hot refresh
#false关闭缓存
spring.thymeleaf.cache=false
########################################################
###FREEMARKER (FreeMarkerAutoConfiguration) freemarker 模版
########################################################
spring.freemarker.allow-request-override=false
spring.freemarker.cache=false
spring.freemarker.check-template-location=true
spring.freemarker.charset=UTF-8
spring.freemarker.content-type=text/html
spring.freemarker.expose-request-attributes=false
spring.freemarker.expose-session-attributes=false
spring.freemarker.expose-spring-macro-helpers=false
#spring.freemarker.prefix=
#spring.freemarker.request-context-attribute=
#spring.freemarker.settings.*=
spring.freemarker.suffix=.ftl
#spring.freemarker.template-loader-path=classpath:/templates/ #comma-separated list
#spring.freemarker.view-names= # whitelist of view names that can be resolved
以上是关于spring-boot 中application.properties的各种配置的主要内容,如果未能解决你的问题,请参考以下文章
spring-boot 中application.properties的各种配置
spring-boot结合maven配置不同环境的profile
如何 JUnit 测试 Spring-Boot 的 Application.java
如何在spring-boot中用application.properties制作config类?