gpt4 book ai didi

java - 将 Constretto 2.0 与 Spring 3.2 集成

转载 作者:行者123 更新时间:2023-12-03 02:58:32 25 4
gpt4 key购买 nike

我正在尝试将 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

关于java - 将 Constretto 2.0 与 Spring 3.2 集成,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16808773/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com