spring的占位符

来源:互联网 发布:大班美工区域观察记录 编辑:程序博客网 时间:2024/05/18 03:31

在spring中是用profiles来区别不同的环境,在profile中应用数据库配置信息出现了

Could not resolve placeholder 'jdbc.url' in string value "${jdbc.url}"这样的提示,


原因是之前配置了占位符

bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list>
                    <value>classpath:application.properties</value>
                </list>
            </property>
        </bean> 


在profile中有配置了查找properties的信息,

context:property-placeholder ignore-unresolvable="true"
location="classpath*:/application.properties" />

导致了冲突,去掉一个,只用一个就可以了。


0 0
原创粉丝点击