applicationContext.xml报错

wangjingqiannihao 2017-06-25 05:33:39
<?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:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">

<!-- 不扫描控制器 -->
<context:component-scan base-package="com.zafu" use-default-filters="false">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>

<!-- Spring的配置文件 这里主要配置和业务逻辑相关的 -->
<!-- ===========数据源 ========-->
<context:property-placeholder location="classpath:dbconfig.properties"/>
<bean id="pooledDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="jdbcUrl" value="${jdbc.jdbcUrl}"></property>
<property name="driverClass" value="${jdbc.driverClass}"></property>
<property name="user" value="${jdbc.user}"></property>
<property name="password" value="${jdbc.password}"></property>
</bean>

<!-- ================配置和MyBatis的整合================= -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 指定mybatis全局配置文件的位置 -->
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="dataSource" ref="pooledDataSource"></property>
<!-- 指定mybatis mapper文件的位置 -->
<property name="mapperLocations" value="classpath:mapper/*.xml"></property>
</bean>

<!-- 配置扫描器 将mybatis接口的实现加入到ioc容器中 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 扫描所有dao接口的实现,加入到ioc容器中 -->
<property name="basePackage" value="com.zafu.crud.dao"></property>
</bean>
<!-- ======================================= -->

<!-- ========事务控制的配置========= -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!-- 控制住数据源 -->
<property name="dataSource" ref="pooledDataSource"></property>
</bean>

<!-- 开启基于注解的事务,使用xml配置形式的事务(必要主要的都是使用配置式) -->
<aop:config>
<!-- 切入点表达式 -->
<!-- 第1个..表示该包下的所有文件 -->
<!-- *表示所有方法 -->
<!-- 第2个..表示方法参数任意多 -->
<aop:pointcut id="txPoint" expression="execution(* com.zafu.crud.service..*(..))" />
<!-- 配置事物增强 -->
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPoint"/>
</aop:config>

<!-- 配置事物增强,食物如何切入 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- 所有方法都是事物方法 -->
<tx:method name="*"/>
<!-- 以get开始的所有方法 -->
<tx:method name="get*" read-only="true"/>
</tx:attributes>
</tx:advice>

<!-- Spring配置文件的核心点(数据源 与mybatis的整合 事物控制) -->

</beans>


错误
Class dependency error 'com/mchange/v2/ser/Indirector' occurred on aspect definition 'Aspect definition
[\ssm_crud\src\main\resources\applicationContext.xml:57] advise type [after] advise
[org.springframework.transaction.interceptor.TransactionInterceptor.invoke]' while processing bean
'pooledDataSource (20) [com.mchange.v2.c3p0.ComboPooledDataSource]'. Check if builder classpath is
complete
...全文
1092 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
风潇潇1991 2017-10-13
  • 打赏
  • 举报
回复
Thanks Barry for these very comprehensive instructions: You found a bug in Spring IDE's class path handling. The problem with your setup is that Spring IDE does not create correct file urls for libraries that are linked from another project. In your case all libs are linked in from the 'thirdparty' project. See the classpath debug output in the Spring AOP Event Trace View to verfiy that the classpath shows all the jars, but some with a wrong file path. Good message here: I've tried to fix this. Please install a svn head snapshot from http://springide.org/bamboo/download...tesite_nightly (this url can be used as eclipse update site) and verify if this fixed the issue. Thanks again. Christian
风潇潇1991 2017-10-13
  • 打赏
  • 举报
回复
http://forum.spring.io/forum/spring-projects/springsource-tool-suite/32530-build-path-incomplete-error
sdluqiang 2017-10-11
  • 打赏
  • 举报
回复
是不是架包依赖错误
wangjingqiannihao 2017-06-30
  • 打赏
  • 举报
回复
没有,我很无奈,这个是网上视频边看边写的代码,居然会报这种错误。
q1503690029 2017-06-28
  • 打赏
  • 举报
回复
我也是这个问题,老哥你解决了吗

8,906

社区成员

发帖
与我相关
我的任务
社区描述
XML/XSL相关问题讨论专区
社区管理员
  • XML/XSL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧