@PropertySource({"classpath:application.properties"})
@Value("${web.file.path}")
private String filePath;
@GetMapping("/test/property-source")
public Object testPropertySource() {
System.out.print("配置注入打印,文件路径为:" + filePath);
return filePath;
}
@Value("${name}")
private String name;
@Value("${domain}")
private String domain;
@Autowired
private ServiceSettings serviceSettings;
@GetMapping("/test/test-properties")
public Object testProperties() {
System.out.println("serviceSettings: " + serviceSettings);
return serviceSettings;
}