记一次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)]找到解决方案

解决方法:
记一次SptingBoot启动报错Error creating bean with name 'requestMappingHandlerAdapter'

/**
 * 用户实体类
 * */
@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;
}

添加之后项目正常启动

记一次SptingBoot启动报错Error creating bean with name 'requestMappingHandlerAdapter'

上一篇:QT事件过滤器(QT事件处理的5个层次:自己覆盖或过滤,父窗口过滤,Application过滤与通知)


下一篇:安卓逆向刷题(攻防世界)