SpringBoot:第三篇 配置修改

1.启动端口修改 application.properties

server.port=8080

2.不同环境配置文件支持 application.properties

spring.profiles.active=prod

3.使用xml配置----启动类添加配置

@ImportResource("classpath:spring-config-*.xml"

4.使用其他配置文件---启动类添加配置

@PropertySource(value = {"classpath:conf.properties"}, encoding = "utf-8")
----使用----
@Value("${user.name}")
private String userName;
原文地址:https://www.cnblogs.com/zgzf/p/11028057.html