Met a strange phenomenon, today to SpringBoot project using maven jars, on the desktop, and then the table has a appliation. The yaml file, the file has nothing to do with the jar package project, happened in the desktop,
When using CMD command, execute Java - jar XXX. Jar, found that it was loaded on the desktop application. The yaml file, if the file is not in conformity with the yaml formats, start the project will be an error?
Why Java - jar XXX. The jar will load applicaiton. With directory yaml files?
CodePudding user response:
https://docs.spring.io/spring-boot/docs/2.3.2.RELEASE/reference/html/spring-boot-features.html#boot-features
Take a closer look at
CodePudding user response:
2.3-2.4
CodePudding user response:
SpringApplication loads the properties from the application. The properties files in the following locations and adds them to the Spring Environment:
A/config subdirectory of the current directory
The current directory
A classpath/config package
The classpath root
The list is ordered by precedence (The properties defined in locations who override in The list are those defined in The lower locations).
CodePudding user response:
refer to the second floor lkwahl response: 2.3 2.4 Document said that Spring will load the classpath under the root of the application. The yaml file, think of a problem, if we refer to a third party jar package b.jar, the top-level directory and the jar package contains an application. The yaml file, then the file will be Spring loaded? CodePudding user response:
Loading yml should not be on the desktop, you can manually specify - spring - config - location=XXX. Yml, CodePudding user response:
reference 5 floor selling fruit net reply: load yml should not be on the desktop, you can manually specify - spring - config - location=XXX. Yml, Spring will load the classpath under the root of the application. The yaml file, think of a problem, if we refer to a third party jar package b.jar, the top-level directory and the jar package contains an application. The yaml file, the file will be Spring loaded? CodePudding user response:
Nohup Java - xx. The jar jar load yml order, with the directory "classPath CodePudding user response:
refer to 7th floor MR_WANG0312 response: nohup Java - jar xx. Jar loading yml order, with "the classPath directory If the loaded with yml files in the directory, will continue to load under the classpath yml file? CodePudding user response:
Not,,,,,,, CodePudding user response:
Springboot default will load the following four configuration file location: 1, if the application. The yaml jars with system under the config directory of unified directory 2, if the application. The yaml jars with system in a unified directory 3, if the application. The yaml jars in the system of resources under the config directory of the root directory 4, if the application. The yaml jars in the system resources of the root directory If the four parts of the application. The yaml file, will be loaded, all have the same configuration before the final CodePudding user response:
references to the tenth floor to watch - north reply: springboot default will load the following four configuration file location: 1, if the application. The yaml jars with system under the config directory of unified directory 2, if the application. The yaml jars with system in a unified directory 3, if the application. The yaml jars in the system of resources under the config directory of the root directory 4, if the application. The yaml jars in the system resources of the root directory If the four parts of the application. The yaml file, will be loaded, all have the same configuration before the subject Thank you very much,