springboot学习(2)-springinitializr,yml

使用springinitializr建立的项目结构如下:

pname
   src
        main
              java
              resources
                     static  保存静态资源例如:css,js,image,
                     templates springboot默认使用内嵌tomcat,默认不支持jsp页面
                     application.properties                  
        test 

yml语言规则:
1.依赖包
2.语言规则和json类似,需要注意每个冒号后跟空格
3.分为行内写法和以‘-’分开分开的方式
4.调用yml内配置参数,需要通过注入

 @ConfigurationProperties(prefix ="person")
 @Component
@ConfigurationProperties @value
使用方式 批量注入属性 单个属性注入
spel 不支持 支持
JRE303 校验 支持 不支持
松散绑定 支持 不支持
复杂类型封装 支持 不支持
发布了40 篇原创文章 · 获赞 1 · 访问量 4480

猜你喜欢

转载自blog.csdn.net/hyt182380/article/details/103672222