异常:Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentExceptio

Posted 栗霖

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了异常: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 ‘my.name‘ in value "${my.name}"

此时配置文件默认的名称为:application.properties 
解决方法: 
将配置文件名改为:application.yml 
就可以正常启动.

后来又发现如果想让配置文件名称为application.properties 
则需要在配置文件中以: 
xxx.yyy.name的格式来书写需要使用到的属性

 






以上是关于异常:Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentExceptio的主要内容,如果未能解决你的问题,请参考以下文章

Injection of autowired dependencies failed;错误解决

Injection of autowired dependencies failed; autowire 自动注入失败,测试类已初始化过了Spring容器。

Field injection is not recommended和Could not autowired. No beans of 'xxx' type found.

spring整合mybatis时运行测试代码报错Injection of autowired dependencies failed,请各位大神帮忙看看

关于@AutoWired依赖注入时有警告----Field injection is not recommended

@Autowired注解警告Field injection is not recommended