spring boot 配置文件properties和YAML详解
2019-09-13 12:40
1191 查看
spring boot 配置文件properties和YAML详解
properties中配置信息并获取值。
1:在application.properties配置文件中添加:
根据提示创建直接创建。
怎么在程序中引用这个值呢?
浏览器访问:
我们可以看到输出的值。
说明:
Application属性配置文件的优先顺序
2:端口修改
在application.properties中直接使用:
server.port=8888
保存后,spring boot会自动帮我们重启。
我们可以看到重启后的端口就为8888了。
3:日期格式:
在上一节课中我们访问saveuser的时候:
创建时间是时间戳。需要修改成正常的。
联系凯哥:
凯哥Java(kaigejava)
个人博客:www.kaigejava.com
怎么配置?
还是在application.properties文件中添加:
spring.jackson.date-format= 时间格式。
如下图:
设置完成之后,在访问:
日期格式正常了。
相关文章推荐
- Spring Boot基础3-配置文件详解:Properties和YAML
- (三)SpringBoot之配置文件详解:Properties和YAML
- Spring Boot -- 配置文件详解:Properties 和 YAML
- Spring Boot 配置文件详解:Properties和YAML
- (三)SpringBoot之配置文件详解:Properties和YAML
- SpringBoot (五) :YAML和PROPERTIES配置文件详解_一点课堂(多岸学院)
- Spring Boot-配置文件详解:Properties和YAML
- Spring Boot 配置文件详解:Properties和YAML
- 详解Spring Boot加载properties和yml配置文件
- springBoot yaml/properties 文件配置参数解析
- Spring Boot系列教程四:配置文件详解properties
- YAML/Properties配置文件与Spring Boot(转)
- Spring Boot系列教程四:配置文件详解properties
- Spring Boot属性配置文件详解
- spring boot application.properties文件外部配置
- Spring Boot属性配置文件详解
- spring boot application properties配置详解
- spring boot application properties配置详解
- SpringBoot(3) Spring Boot属性配置文件详解
- Spring Boot属性配置文件详解