Spring-Boot配置檔案之application.properties常用配置
阿新 • • 發佈:2020-07-21
1、配置埠和專案名訪問
#指定springboot內嵌容器啟動的埠,預設使用tomcat容器時在8080埠
server.port=8081
#配置專案訪問路徑
server.servlet.context-path=/boot
2、資料庫連線配置#描述資料來源
spring.datasource.url=jdbc:mysql://localhost:3306/demo spring.datasource.username=root spring.datasource.password=0000 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
3、資料持久化配置
spring.jpa.hibernate.ddl-auto=update #是否列印sql語句 #spring.jpa.show-sql= true #mybatisdebug模式 #logging.level.cn.xt.mapper=debug #mybatis配置檔案路徑 #mybatis.config-location=classpath:MyBatis.xml #mybatis.mapper-locaitons=classpath:mybatis/mappings/*.xml #別名實體包,多個逗號隔開 #mybatis.type-aliases-package=com.user.bean #SpringMVC檢視解析器 spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.suffix=.jsp #jsp,servlet修改後無需重新發布 server.jsp-servlet.init-parameters.development=true spring.cache.ehcache.config=ehcache.xml
4、檔案上傳大小配置
#SpringBoot單個上傳檔案的大小
spring.servlet.multipart.maxFileSize=200MB
#SpringBoot總上傳檔案大小
spring.servlet.multipart.maxRequestSize=200MB