spring-mybatis 报错

J2EE 码拜 4年前 (2016-09-18) 676次浏览
Error creating bean with name “sqlSessionFactory” defined in class path resource [config/yb-spring.xml]: Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
如下为spring配置文件:
<aop:aspectj-autoproxy />
<import resource=”classpath*:config/yb-datasource.xml” />
<import resource=”classpath*:config/yb-dubbo.xml” />
<context:component-scan base-package=”com.mbk.yb” />
<context:property-placeholder location=”classpath:resources.properties” />
<bean id=”sqlSessionFactory” class=”org.mybatis.spring.SqlSessionFactoryBean” >
<property name=”dataSource” ref=”dataSource” />
<property name=”mapperLocations” value=”classpath*:com/mbk/yb/model/user/*.xml” />
</bean>
<!– springmybatis整合配置,扫描全部dao –>
<bean class=”org.mybatis.spring.mapper.MapperScannerConfigurer”
p:basePackage=”com.mbk.yb” p:sqlSessionFactoryBeanName=”sqlSessionFactory” />
<tx:annotation-driven transaction-manager=”txManager” />
<bean id=”transactionManager” class=”org.springframework.jdbc.datasource.DataSourceTransactionManager”
p:dataSource-ref=”dataSource” />
<tx:advice id=”transactionAdvice” transaction-manager=”transactionManager”>
<tx:attributes>
<tx:method name=”add*” propagation=”REQUIRED” />
<tx:method name=”append*” propagation=”REQUIRED” />
<tx:method name=”insert*” propagation=”REQUIRED” />
<tx:method name=”save*” propagation=”REQUIRED” />
<tx:method name=”update*” propagation=”REQUIRED” />
<tx:method name=”modify*” propagation=”REQUIRED” />
<tx:method name=”edit*” propagation=”REQUIRED” />
<tx:method name=”delete*” propagation=”REQUIRED” />
<tx:method name=”remove*” propagation=”REQUIRED” />
<tx:method name=”repair” propagation=”REQUIRED” />
<tx:method name=”delAndRepair” propagation=”REQUIRED” />
<tx:method name=”get*” propagation=”SUPPORTS” />
<tx:method name=”find*” propagation=”SUPPORTS” />
<tx:method name=”load*” propagation=”SUPPORTS” />
<tx:method name=”search*” propagation=”SUPPORTS” />
<tx:method name=”datagrid*” propagation=”SUPPORTS” />
<tx:method name=”*” propagation=”SUPPORTS” />
</tx:attributes>
</tx:advice>
<bean id=”druid-stat-interceptor”
class=”com.alibaba.druid.support.spring.stat.DruidStatInterceptor” />
<bean id=”druid-stat-pointcut” class=”org.springframework.aop.support.JdkRegexpMethodPointcut”
scope=”prototype”>
<property name=”patterns”>
<list>
<value>com.mbk.yb.service.ipml.*</value>
</list>
</property>
</bean>
<aop:config>
<aop:advisor advice-ref=”druid-stat-interceptor”
pointcut-ref=”druid-stat-pointcut” />
</aop:config>
解决方案

20

是不是包冲突了?   Spring的版本是2.5么?  删除Spring2.5中一个asm 2.2.3的jar包试试

10

10

本人遇到的都是mybatis中的sql配置问题的,要么id重复,要么xml重复加载

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明spring-mybatis 报错
喜欢 (0)
[1034331897@qq.com]
分享 (0)