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;
    }
    

    添加之后项目正常启动

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

  • 相关阅读:
    71 是否同一棵二叉搜索树(25 分)
    75 平衡二叉树的根(25 分)
    72 树种统计(25 分)
    2018(容斥定理 HDU6286)
    直观的理解计算机中的数值编码
    如何关闭emacs开启时自己打开的欢迎界面
    图论:最短路径:广度优先搜索(C语言实现)
    ubunut 14.04 将Caps Lock设置为Control
    邻接表:C语言实现
    队列(C语言实现)
  • 原文地址:https://www.cnblogs.com/weidaijie/p/14332025.html
Copyright © 2011-2022 走看看