SpringBoot约定大于配置

约定大于配置就是开箱即用中那些自动配置的细节,具体点就是配置文件(.yml)应该放在哪个目录下、命名规范等都可以被称为约定。

maven目录结构的约定

Spring官方文档,文档中描述的目录结构:

Config locations are searched in reverse order. By default, the configured locations are classpath:/,classpath:/config/,file:./,file:./config/. The resulting search order is the following:

译为:file:./config/、file:./、classpath:/config/、classpath:/。

spring的配置文件目录可以放在/config、/(根目录)、resource/config/、resource/,这四个路径从上到下存在优先级关系。

你可能感兴趣的:(分布式微服务框架,开源框架及中间件,java,spring,boot)