xml文件中配置了
<context:property-placeholder location="classpath:properties/aa.properties"/>
在调用该参数时,却报错找不到。
追踪日志的时候发现没有扫描该文件。通过一番搜索,得到了一个不负责的答案:加入忽略属性,即如果在搜索${}参数时没有发现则忽略。这绝对是治标不治本的。
最后还是在再次追踪日志时发现,我写了两处properties扫描,即<context:property-placeholder location="classpath:properties/aa.properties"/>,却只进行了一次扫描,也就是只扫描注入了一个文件。
于是我删去了其中一处,只进行一次总体扫描,即<context:property-placeholder location="classpath:properties/*.properties"/>,最终完美解决。