springboot全局配置文件
application.properties
//简单实例,更改端口以及context-path
server.port=8099
server.servlet.context-path=/helloboot
application.properties文件是全局属性配置文件
要自定义属性,则可在此文件中定义,并在调用的类中使用@Value注入即可
@Value("${xx.yy}")
或者基于安全的配置(properties)
通过注解@ConfigurationProperties将properties属性和一个Bean及其属性相关联
@ConfigurationProperties(prefix="author")
日志配置
logging.file.name=e:/myLog/log.log
logging.level.org.springframework.web=debug
profile配置,基于不同properties文件配置
//application.properties 选中prod配置环境
spring.profiles.active=prod
//application-prod.properties
server.port=9099