解决Spring controller层@value("${properties文件属性名}")找不到配置文件的问题

mac2022-06-30  16

原因,spring mvc与spring所属框架不同,因此容器也不同,只在service开启的属性注入,在controller层用不了

可以在springmvc 的配置文件中再次开启 propertyPlaceholder

<context:property-placeholder location="/WEB-INF/config/properties/global.properties"/>

转载于:https://www.cnblogs.com/siran/p/11205691.html

最新回复(0)