前几天看见springDataJpa不用先建立table ,直接用对象生成,就像python,所以想试试,用springBoot整合下,结果很让人纠结:
配置如下,启动报错:
java.lang.NoSuchMethodError: org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource.<init>(Lorg/springframework/core/type/AnnotationMetadata;Ljava/lang/Class;Lorg/springframework/core/io/ResourceLoader;Lorg/springframework/core/env/Environment;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;)V
度娘下说包有冲突。一时半会找不到冲突的包。
想着吧springBoot的版本降低到1.5.2 在启动没问题了user的bean也建立了表进DB。
看来就是springBoot的1.5.6的版本带来的问题。好纠结
springBoot.:1.5.6.RELEASE
POM文件
<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.6.RELEASE</version> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency>
application.yml
spring: datasource: url: jdbc:mysql://localhost:3306/test username: root password: root driver-class-name: com.mysql.jdbc.Driver jpa: database: mysql show-sql: true hibernate: ddl-auto: update naming: strategy: org.hibernate.cfg.DefaultComponentSafeNamingStrategy properties: hibernate: dialect: org.hibernate.dialect.MySQL5Dialect
userbean:
@Entity @Table(name = "user_info") public class UserInfo { @Id @GeneratedValue @Column(name = "id") private Integer id; @Column(name = "login_name", unique = true) private String LoginName;//登陆帐号 @Column(name = "nick_name") private String nickName;//昵称 @Column(name = "login_pwd") private String password; //登陆密码; private String salt;//加密密码的盐 private char status; ...getter and setter..
启动报错部分
2017-08-31 08:46:59.913 [main] 5732 INFO com.hank.framework.FrameworkApplication - The following profiles are active: dev 2017-08-31 08:47:00.151 [main] 5732 INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@291a7e3c: startup date [Thu Aug 31 08:47:00 CST 2017]; root of context hierarchy 2017-08-31 08:47:00.792 [background-preinit] 5732 INFO org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.3.5.Final 2017-08-31 08:47:02.254 [main] 5732 ERROR org.springframework.boot.SpringApplication - Application startup failed java.lang.NoSuchMethodError: org.springframework.data.repository.config.AnnotationRepositoryConfigurationSource.<init>(Lorg/springframework/core/type/AnnotationMetadata;Ljava/lang/Class;Lorg/springframework/core/io/ResourceLoader;Lorg/springframework/core/env/Environment;Lorg/springframework/beans/factory/support/BeanDefinitionRegistry;)V at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport$1.<init>(AbstractRepositoryConfigurationSourceSupport.java:68) at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport.getConfigurationSource(AbstractRepositoryConfigurationSourceSupport.java:67) at org.springframework.boot.autoconfigure.data.AbstractRepositoryConfigurationSourceSupport.registerBeanDefinitions(AbstractRepositoryConfigurationSourceSupport.java:58) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:352) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143) at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:336) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:246) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:270) at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:93) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:686) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:524) at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.hank.framework.FrameworkApplication.main(FrameworkApplication.java:18) 2017-08-31 08:47:02.256 [main] 5732 INFO o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@291a7e3c: startup date [Thu Aug 31 08:47:00 CST 2017]; root of context hierarchy 2017-08-31 08:47:02.257 [main] 5732 WARN o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext - Exception thrown from LifecycleProcessor on context close java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@291a7e3c: startup date [Thu Aug 31 08:47:00 CST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:417) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1002) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:961) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.hank.framework.FrameworkApplication.main(FrameworkApplication.java:18) 2017-08-31 08:47:02.259 [main] 5732 ERROR o.s.b.factory.support.DefaultListableBeanFactory - Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@291a7e3c: startup date [Thu Aug 31 08:47:00 CST 2017]; root of context hierarchy at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404) at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:954) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:961) at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033) at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1009) at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:961) at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:750) at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) at com.hank.framework.FrameworkApplication.main(FrameworkApplication.java:18)
相关推荐
本系统是基于Thymeleaf+SpringBoot+SpringDataJPA实现的的中小医院信息管理系统。简单实现了挂号收费,门诊管理,划价收费,药房取药,体检管理,药房管理,系统维护等基础功能。就诊卡提供了手动和读卡两种方式录入...
《构建基于SpringBoot+SpringDataJPA+Mysql的课表排课及实验室机房管理系统》 在现代教育信息化管理中,课表排课及实验室机房管理是至关重要的环节。借助于先进的技术和框架,我们可以构建高效、智能的管理系统。本...
综上所述,SpringBoot+SpringDataJPA+Thymeleaf+Shiro的组合为开发高效、安全的管理平台提供了坚实的基础。它们各自负责不同的层面:SpringBoot负责项目结构和运行环境,SpringDataJPA处理数据访问,Thymeleaf实现...
仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot+Spring Data JPA.zip仓库管理系统,SpringBoot...
基于SpringBoot+Spring Data JPA+mybatis的仓库管理系统 基于SpringBoot+Spring Data JPA+mybatis的仓库管理系统 基于SpringBoot+Spring Data JPA+mybatis的仓库管理系统 基于SpringBoot+Spring Data JPA+mybatis的...
使用 SpringBoot + SpringDataJPa 设计通用的权限管理系统,适合管理系统快速开发迭代,可用于开发模板,项目经过测试,可完美运行! 使用 SpringBoot + SpringDataJPa 设计通用的权限管理系统,适合管理系统快速...
1、基于SpringBoot+Spring Data JPA+mybatis的仓库管理系统源码.zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考...
Java本科毕业设计-Springboot+Spring Data JPA 仓库管理系统,也可做期末大作业,课程设计。Java本科毕业设计-Springboot+Spring Data JPA 仓库管理系统,也可做期末大作业,课程设计。Java本科毕业设计-Springboot+...
在 "springboot+spring data jpa+thymeleaf学习web项目整合demo源码" 中,我们可以学习到以下几个关键知识点: 1. **Spring Boot 整合**:Spring Boot 可以与多个框架集成,如 Spring MVC、Spring Data 和 ...
综合上述技术,这个项目可能是一个使用SpringBoot作为基础框架,通过Spring Data JPA进行数据库操作,使用FreeMarker作为模板引擎展示页面,Shiro负责安全控制,而Log4jdbc则用于记录数据库查询日志的Web应用。...
在SpringBoot项目中,pom.xml用于声明SpringBoot起步依赖、SpringData JPA、Scala库、MySQL驱动等相关依赖,使得Maven能够自动下载和管理这些依赖。 【src】 src目录是Java项目中的源代码目录,通常包含main和test...
【标题】"webmagic+springboot+SpringDataJpa.zip"是一个包含集成WebMagic爬虫框架、Spring Boot和Spring Data JPA技术的项目压缩包。这个项目旨在展示如何利用这些技术进行定时抓取网站数据,并将抓取到的数据存储...
【标题】"基于SpringBoot + SpringData JPA + SpringSecurity + SpringSec.zip" 所涉及的知识点涵盖了四个关键的Java开发框架,它们分别是SpringBoot、SpringData JPA、SpringSecurity和SpringSec。这些技术在现代...
SpringBoot + Data JPA + Thymeleaf 是一个常见的Java Web开发组合,它极大地简化了项目的搭建和数据库操作。这个简单的DEMO展示了如何利用这些技术快速构建一个包含用户管理功能的Web应用。以下是对这个DEMO中涉及...
基于vue-cli脚手架以及基于SpringBoot+SpringSecurity+JWT+SpringDataJpa的前后端java 项目
SpringBoot和SpringData JPA是Java开发中的两个关键框架,它们极大地简化了Web应用程序的构建过程,特别是数据库操作。SpringBoot以其"开箱即用"的特性,减少了配置工作,而SpringData JPA则提供了对Java ...
《仓库管理系统:SpringBoot+Spring Data JPA+MyBatis深度解析》 仓库管理系统是企业信息化建设中的重要一环,它有效地管理库存,确保资源的高效利用。本系统基于SpringBoot、Spring Data JPA和MyBatis框架进行构建...
【标题】:“仓库管理系统,SpringBoot+Spring Data JPA+……” 这个系统是基于Spring Boot框架构建的一个仓库管理解决方案。Spring Boot是Java生态系统中的一个流行框架,它简化了创建独立的、生产级别的基于...
TIMO后台管理系统,基于SpringBoot2.0 + Spring Data Jpa + Thymeleaf + Shiro 开发的后台管理系统,采用分模块的方式便于开发和维护,支持前后台模块分别部署,目前支持的功能有:权限管理、部门管理、字典管理、...