Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentExceptio
异常:Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘java’ in value “${java}”
这个异常是出现在注入配置文件中配置好的属性时报错的,要看看@Value("${java1}")
中注入的是不是关键字之类的,一开始我写的是@Value("${java}")
就报错,运行失败,在java后随便加个1就可以运行了
@RestController
public class HelloController {
@Value("${java1}")
String java1;
@GetMapping("/hello")
public String hello() {
return java1;
}
}