Spring配置文件如下
<!-- ibatis2.x 配置 -->
<!-- 配置系统的数据源 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<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="maxActive" value="80" />
<property name="maxIdle" value="40" />
<property name="maxWait" value="60000" />
<property name="logAbandoned" value="true" />
<property name="removeAbandoned" value="true" />
<property name="removeAbandonedTimeout" value="180" />
<property name="testWhileIdle" value="true"></property>
<property name="timeBetweenEvictionRunsMillis" value="300000"></property>
<property name="minEvictableIdleTimeMillis" value="320000"></property>
</bean>
<!-- 配置iBatis的sqlMapClient -->
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:com/config/ibatis/ibatis-map-config.xml</value>
</property>
</bean>
<!-- 根据sqlMapClien获取 一个SqlMapClient模版 -->
<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
<property name="sqlMapClient" ref="sqlMapClient" />
</bean>
在类中注入时
@Resource
private SqlMapClientTemplate sqlMapClientTemplate;
报以下错误
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sqlMapClientTemplate' is defined: not found in JNDI environment
但是在tomcat下运行正常,求解答
------解决方案--------------------------------------------------------
将相应的*.jar 复制到lib下!