SSM整合中nested exception is java.lang.IllegalArgumentException

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37969433/article/details/80969145

在学习ssm框架的过程中,对spring管理mapper中使用mapper批量扫描。

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="basePackage" value="cn.csdn.sm.mapper"/>
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>

    </bean>

出现了以下问题

org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [E:\eclipse workspace(java)\mySSM\build\classes\cn\csdn\sm\mapper\StuMapper.class]; nested exception is java.lang.IllegalArgumentException

    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:281)

    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.doScan(ClassPathBeanDefinitionScanner.java:242)

    at org.mybatis.spring.mapper.ClassPathMapperScanner.doScan(ClassPathMapperScanner.java:155)

    at org.springframework.context.annotation.ClassPathBeanDefinitionScanner.scan(ClassPathBeanDefinitionScanner.java:220)

    at org.mybatis.spring.mapper.MapperScannerConfigurer.postProcessBeanDefinitionRegistry(MapperScannerConfigurer.java:315)

    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:630)

    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:461)

    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)

    at cn.csdn.sm.test.StuMapperTest.setUp(StuMapperTest.java:18)
    ......

出现此问题的原因为spring版本与jdk8版本兼容问题

解决方案:用更高版本的spring

提供ssm框架的完整jar包:网盘下载 密码h9w9

展开阅读全文

没有更多推荐了,返回首页