1 The location and content of the configuration document
Add the configuration document test.properties under src/main/resources, and the document encoding format is utf-8.
2 Several ways to read documents
2.1 Reading through the PropertiesLoaderUtils class
import org.springframework.core.io.support.PropertiesLoaderUtils;
Properties properties = PropertiesLoaderUtils.loadAllProperties("test.properties");
String test = properties.getProperty("test");
System.out.println("properties.test:"+test);
2.2 Reading through the java.util.ResourceBundle class
//No need to add the .properties suffix, just the file name
//test.properties configuration file is under com.test.config, then wei com/test/config/test
ResourceBundle resource = ResourceBundle.getBundle("test");
String test = resource.getString("test");
System.out.println("resource.test:"+test);