我正在尝试将constretto(2.0.4)与Spring 3.2.3.RELEASE一起使用。
我的applicationContext.xml文件:
<beans default-lazy-init="true"
xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:constretto="http://constretto.org/schema/constretto"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://constretto.org/schema/constretto http://constretto.org/schema/constretto/constretto-1.2.xsd
">
<constretto:configuration annotation-config="true" property-placeholder="true">
<constretto:stores>
<constretto:properties-store>
<constretto:resource location="file:/data/config/app.properties"/>
</constretto:properties-store>
</constretto:stores>
</constretto:configuration>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"
lazy-init="false"
p:driverClassName="${jdbc.driver}"
p:url="${jdbc.url}"
p:username="${jdbc.user}"
p:password="${jdbc.password}"
p:initialSize="5"
p:maxActive="100"
p:maxIdle="30"
p:maxWait="1000"
p:poolPreparedStatements="true"
p:defaultAutoCommit="false"
p:removeAbandoned="true"
p:removeAbandonedTimeout="60">
</bean>
我有所有属性的app.properties文件,看起来好像根本没有加载,也没有调用任何constretto类。
我得到错误:
Could not resolve placeholder 'jdbc.driver' in string value "${jdbc.driver}"
知道为什么它不起作用吗?有人成功进行了整合吗?
最佳答案
它适用于Constretto 2.2版