URL Original Answer

By default ,SpringApplication loads properties from application.properties files in the following locations and adds them to the Spring Environment:

  1. A /config subdirectory of the current directory
  2. The current directory
  3. A classpath /config package
  4. The classpath root

As same as

  1. file:./config/
  2. file:./
  3. classpath:/config/
  4. classpath:/

The list is ordered by precedence

classpath:/config/ and classpath:/ it`s ok , but when i put file in file:./config/ or file:./ . there are some problem happends

IDEA

When application.properties locate in resources or /resourece/config , it works
spring boot load the property files by four ways
But if i put the application.properties in the subdirectory of the current directory or ./config it can not work
spring boot load the property files by four ways
spring boot load the property files by four ways

i do it just like doc says ,but it failed . so google ~~

the location file:./config/ and file:./ not means your idea folder it means below
spring boot load the property files by four ways
when you use maven to package the project you can get a XXX.jar in targer
spring boot load the property files by four ways

NEXT

spring boot load the property files by four ways
NEXT
spring boot load the property files by four ways
spring boot load the property files by four ways

that`s alll

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-05-24
  • 2021-04-16
  • 2022-12-23
  • 2021-12-17
猜你喜欢
  • 2022-12-23
  • 2021-09-19
  • 2021-11-16
  • 2021-09-09
  • 2021-07-04
  • 2021-08-25
  • 2021-11-04
相关资源
相似解决方案