Could not resolve placeholder 'casServerUrlPrefix' in string value "${casServerUrlPrefix}"

    xiaoxiao2021-03-26  8

    引入

    在做项目的过程中,因为底层动了一些东西,导致Jboss启动报错。经过一番努力,最后顺利解决,与大家分享。

    错误

    错误信息为:Could not resolve placeholder 'casServerUrlPrefix' in string value "${casServerUrlPrefix}"

    原因

    错误原因是底层将原先的shiro-cas抽离了出来,写了一个配置文件,造成和原先redis的冲突,redis将其覆盖了。

    解决办法

    解决办法就是在每个配置文件中加一句代码:

    <property name="ignoreUnresolvablePlaceholders" value="true" /> 目的是使程序在读配置文件的时候,保证上一个不被冲掉。示例:

    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:config/redis.properties</value> </list> </property> <property name="ignoreUnresolvablePlaceholders" value="true" /> </bean> <!-- 用于扫描其他的.properties配置文件 --> <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <list> <value>classpath:config/shiro-cas.properties</value> </list> </property> <property name="ignoreUnresolvablePlaceholders" value="true" /> </bean> 重新部署运行程序,正常启动!

    小结

    任何错误都是成长最有效的途径,抓住犯错误的机会,在错误中茁壮成长。

    转载请注明原文地址: https://ju.6miu.com/read-650177.html

    最新回复(0)