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

    添加之后项目正常启动

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

  • 相关阅读:
    DWR2.0的DefaultContainer can't find a classes异常的解决方案
    IIS7.5(FastCGI)PHP7安装手记
    android手机一句话备忘录
    设计模式学习每日一记(21.叠代器模式)
    设计模式学习每日一记(20.中介者模式)
    C&C++多系统集成需要注意的问题
    设计模式学习每日一记(23.责任链模式)
    设计模式学习每日一记(22.访问者模式)
    源码阅读工具总结
    zte v880刷机入门篇
  • 原文地址:https://www.cnblogs.com/weidaijie/p/14332025.html
Copyright © 2011-2022 走看看