在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" />
导致了冲突,去掉一个,只用一个就可以了。