最近只要稍微学一点东西就觉得很有收获,好像自己的储备彻彻底底不够用了,需要赶紧补充点技术能量
git上搜到一个大神项目https://github.com/xkcoding/spring-boot-demo,感觉超级棒,于是开启spring boot项目学习之旅
目标:获取配置文件的自定义配置,以及多个环境之间如何切换配置文件
理解:不是很到位没有理解目标的含义,看到这篇文章https://segmentfault.com/a/1190000020247777之后突然理解了
additional-spring-configuration-metadata.json该文件的内容是元数据,我自己理解成它是对在配置文件中配置时会用的键值或者说属性的定义,然后在配置文件application.xml或者是application.properties中会有提示,这里我做了个小实验,后面会讲到
一、目录:
二、元数据: additional-spring-configuration-metadata.json,它的位置是在src/main/resources/META-INF文件夹下面,
META-INF文件夹是自己建的。
{
"properties": [
{
"name": "application.name",
"description": "Default value is artifactId in pom.xml.",
"type": "java.lang.String"
},
{
"name": "application.version",
"description": "Default value is version in pom.xml.",
"type": "java.lang.String"
},
{
"name": "developer.name",
"description": "The Developer Name.",
"type": "java.lang.String"
},
{
"name": "developer.website",
"description": "The Developer Website.",
"type": "java.lang.String"
},
{
"name": "developer.qq",
"description": "The Developer QQ Number.",
"type": "java.lang.String"
},
{
"name": "developer.phone-number",
"description": "The Developer Phone Number.",
"type": "java.lang.String"