Let's start with the file structure of target directory.
The properties file is stored in the Conf folder,
The Lib folder contains a variety of jar files,
Start.bat is the startup file for the Windows command line.
What to do in the properties file
1. Create a configuration file-related configuration class with each properties file corresponding to a configuration class
The @configurationproperties is used here,
Prefix refers to a prefix in the properties file, such as Asdf.name, where the prefix is asdf, and the name in the entity class corresponds to the name behind ASDF.
Locations is the address of the properties file, here I use file, not classpath, use classpath always problem, do not know why. The Conf folder is because the start command line is at the target root directory, and the directory that is currently running is the target root directory.
2. Add @enableconfigurationproperties in the application class
There are several configuration classes that you will add.
3. Import in the place you want to use
4. You can use the
How Spring boot reads the properties file outside the jar package