0
我寫的Spring Boot應用程序。我使用文件application.properties來包含數據庫的配置。但是現在我想從application.yml中獲取屬性,其中包含:無法讀取application.yml
rest:
response: RESPONSE
@RestController
public class MyController {
@Value("${rest.response}")
private String restResponse;
@GetMapping("/foo")
public ResponseEntity<String> register() {
return restResponse;
}
}
目錄資源包含application.properties和application.yml。爲什麼我無法從.yml導入屬性?
你有一個目錄中的application.properties和application.yml? – pezetem
是的,我有這些文件在同一個目錄中 – user