Cannot use @value() annotation in springmvc

After tossing around for an afternoon, I tried a lot of solutions, that is, the properties file could not be scanned in life and death. I originally planned to use soft coding, but I tried to change all the jar package versions, but still couldn't solve it.

I thought about it later, the loading order of spring and springmvc containers, springmvc only scans the controller package, so it is not loaded into the properties file

Solution: Re-scan the properties file in the springmvc.xml configuration file to solve it.

[html]  view plain copy  
 
  1. <context:property-placeholder location="classpath:env.properties" />  

It has been encountered before, and it is directly hard-coded later. It seems that the pit will be filled sooner or later. It is necessary to solve the problem in time.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325162842&siteId=291194637