无法解析jdbc.init?

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [spring-dao.xml]: Could not resolve placeholder 'jdbc.init' in value "${jdbc.init}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'jdbc.init' in value "${jdbc.init}"
网上的解决办法是降版本,降了版本,还是没有解决,最新版本也是这个问题,真不知道该怎么解决了
以下是:spring-dao.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"

   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:aop="http://www.springframework.org/schema/aop"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">
<!--关联数据库配置文件-->
<!--读取jdbc.properties配置文件参数化-->

<context:property-placeholder location="classpath:jdbc.properties"/>

<!--连接池-->
<!--集成Druid连接池-->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    <!--基本配置-->
    <property name="driverClassName" value="${jdbc.driver}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>

    <!--配置初始化大小,最大,最小-->
    <property name="initialSize" value="${jdbc.init}"/>
    <property name="minIdle" value="${jdbc.minIdle}"/>
    <property name="maxActive" value="${jdbc.maxActive}"/>

    <!--配置获取连接等待超时时间-->
    <property name="maxWait" value="60000"/>
    <!--配置间隔多久时间才能进行一次检测,检测需要关闭的空闲连接,单位是毫秒-->
    <property name="timeBetweenEvictionRunsMillis" value="60000"/>
    <!--配置连接池中最小生存时间,单位是毫秒-->
    <property name="minEvictableIdleTimeMillis" value="300000"/>
</bean>

阅读 1.6k
1 个回答

我感觉你应该是没把jdbc.properties编译到target下去

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题