首页 > 解决方案 > Springboot别名'Int'已经映射到值'java.lang.Integer'

问题描述

当我重命名应用程序包名并尝试启动 springboot 时,我收到一条错误消息。错误信息如下:

17:36:19.198 [restartedMain] WARN osbwscAnnotationConfigServletWebServerApplicationContext - [log,87] - 上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.BeanCreationException:在类路径资源中定义名称为“objectMapperConfigurer”的 bean 创建错误[springfox/documentation/spring/web/SpringfoxWebMvcConfiguration.class]:bean实例化之前的BeanPostProcessor失败;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException:在类路径资源 [net/changhai/framework/config/ShiroConfig.class] 中定义名称为“authorizationAttributeSourceAdvisor”的 bean 创建时出错:通过方法“authorizationAttributeSourceAdvisor”参数 0 表示的依赖关系不满足; 嵌套异常是 org. springframework.beans.factory.UnsatisfiedDependencyException:在类路径资源[net/changhai/framework/config/ShiroConfig.class]中定义的名称为'shiroFilterFactoryBean'的bean创建时出错:通过方法'shiroFilterFactoryBean'参数0表示的不满足的依赖关系;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException:在类路径资源 [net/changhai/framework/config/ShiroConfig.class] 中定义名称为 'securityManager' 的 bean 创建错误:通过方法 'securityManager' 参数 0 表达的不满足的依赖关系; 嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为 'userRealm' 的 bean 时出错:通过字段 'menuService' 表达的依赖关系不满足;嵌套异常是 org.springframework。beans.factory.UnsatisfiedDependencyException:创建名为“sysMenuServiceImpl”的bean时出错:通过字段“menuMapper”表示不满足的依赖关系;嵌套异常是 org.springframework.beans.factory.UnsatisfiedDependencyException:在文件 [D:\dev\cube2\ch-system\target\classes\net\changhai\system\mapper\SysMenuMapper. class]:通过 bean 属性 'sqlSessionFactory' 表达的不满足的依赖关系;嵌套异常是 org.springframework.beans.factory.BeanCreationException:在类路径资源 [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class] 中定义名称为“sqlSessionFactory”的 bean 创建时出错:通过工厂方法进行的 bean 实例化失败;嵌套异常是 org.springframework.beans.BeanInstantiationException:无法实例化[org.apache.ibatis.session.SqlSessionFactory]:工厂方法'sqlSessionFactory'抛出异常;嵌套异常是 org.apache.ibatis.type.TypeException:别名“Int”已映射到值“java.lang.Integer”。

标签: spring-bootmybatis

解决方案


看来您正在将别名“Int”绑定到某个类。默认情况下它绑定到 java.lang.Integer,所以它被 MyBatis 保存,你不应该将它重新绑定到另一个。


推荐阅读