zoukankan      html  css  js  c++  java
  • 记一次SptingBoot启动报错Error creating bean with name 'requestMappingHandlerAdapter'

    报错信息如下

    org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'requestMappingHandlerAdapter' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Unsatisfied dependency expressed through method 'requestMappingHandlerAdapter' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mvcConversionService' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.format.support.FormattingConversionService]: Factory method 'mvcConversionService' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in com.dj.lunch.dao.UserRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [sex] in table [t_user]; found [tinyint (Types#TINYINT)], but expecting [integer (Types#INTEGER)]
    

    google了一下午原因,最后从found [tinyint (Types#TINYINT)], but expecting [integer (Types#INTEGER)]找到解决方案

    解决方法:

    /**
     * 用户实体类
     * */
    @Data
    @Entity
    @Table(name="t_user")
    public class UserDO {
        @Id
        @GeneratedValue(strategy = GenerationType.IDENTITY)
        private Integer id;
        private String userName;
        private String password;
        @Column(name = "sex", columnDefinition = "TINYINT(1)")
        private Integer sex;
        private Date lastLoginTime;
    }
    

    添加之后项目正常启动

    另一个项目也是这个坑,记录一下

  • 相关阅读:
    PL/SQL Developer 和 instantclient客户端安装配置(图文)
    VirtualBox + Centos 使用NAT + Host-Only 方式联网
    zookeeper的安装
    Socket编程基础篇
    WebSocket教程(二)
    WebSocket教程(一)
    Js判断浏览器类型
    JVM内存模型
    js 正则去除指定的单词
    Java线上应用故障排查之一:高CPU占用
  • 原文地址:https://www.cnblogs.com/weidaijie/p/14332025.html
Copyright © 2011-2022 走看看