springmvc框架 controller层获取不到@Value的值

原因: 只在applicationContext中添加了扫描,没有在SpringMVC对应的配置文件中扫描。

解决:在srping-mvc.xml 中添加

<context:property-placeholder location="classpath:config.properties" ignore-unresolvable="true" />
发布了152 篇原创文章 · 获赞 39 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/top_explore/article/details/104867034