SpringBoot系列之四全局配置

来源:互联网 发布:网络黑钱提现 编辑:程序博客网 时间:2024/05/16 11:55

一、在src/main/resources代码目录下,建立application.properties文件

二、可配置内容实例如下

#配置context pach , 访问地址就是http://ip:port/spring-boot-helloserver.context-path=/spring-boot-helloserver.port=8081#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###########################################################datasource -- \u6307\u5b9amysql\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f.########################################################spring.datasource.url = jdbc:mysql://localhost:3306/testspring.datasource.username = rootspring.datasource.password = rootspring.datasource.driverClassName = com.mysql.jdbc.Driverspring.datasource.max-active=20spring.datasource.max-idle=8spring.datasource.min-idle=8spring.datasource.initial-size=10########################################################### Java Persistence Api --  Spring jpa\u7684\u914d\u7f6e\u4fe1\u606f.######################################################### Specify the DBMSspring.jpa.database = MYSQL# Show or not log for each sql queryspring.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


原创粉丝点击