工具-idea:eclipse下的maven项目迁移至idea后,通过别名方式的类在mapper中解析不到

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

1.背景:

    ssm架构中,未避免mapper.xml文件在引用对应的类文件时,通过别名的方式制定对应的类关系。如下图,通过typeAliases批量包声明的方式,避免在mapper.xml中大量使用 com.wpao.shop.model.SiteBean的方式调用,直接通过SiteBean的方式调用

2.通过批量包声明的方式在idea中出现类解析错误

严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [C:\Users\dada\Downloads\workspace_5pao\wpao-webCenter\wpao-theuser\target\wpao-theuser\WEB-INF\classes\com\wpao\shop\mapper\about.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving class. Cause: org.apache.ibatis.type.TypeException: Could not resolve type alias 'SiteBean'.  Cause: java.lang.ClassNotFoundException: Cannot find class: SiteBean
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1589)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:554)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)

3.处理方案

猜你喜欢

转载自blog.csdn.net/qq_38331606/article/details/90483499