Today in a project to meet a problem, the entity class forgot to specify the primary key ID, and then reported the following error, but also caused by their carelessness, in this record.
java.lang.IllegalStateException:Failed to load Applicationcontextat Org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext ( defaultcacheawarecontextloaderdelegate.java:124) at Org.springframework.test.context.support.DefaultTestContext.getApplicationContext (defaulttestcontext.java:83) At Org.springframework.test.context.web.ServletTestExecutionListener.setUpRequestContextIfNecessary ( servlettestexecutionlistener.java:189) at Org.springframework.test.context.web.ServletTestExecutionListener.prepareTestInstance ( servlettestexecutionlistener.java:131) at Org.springframework.test.context.TestContextManager.prepareTestInstance (testcontextmanager.java:230) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest (springjunit4classrunner.java:228) at Org.springframework.test.context.junit4.springjunit4classrunner$1.runreflectivecall ( springjunit4classrunner.java:287) at Org.junit.internal.runners.model.ReflectiveCallable.run ( Reflectivecallable.java: +) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock (Springjunit4classrunner.java : 289) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild (Springjunit4classrunner.java : 247) at Org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild (Springjunit4classrunner.java : 94) at Org.junit.runners.parentrunner$3.run (parentrunner.java:290) at Org.junit.runners.parentrunner$1.schedule ( parentrunner.java:71) at Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288) at org.junit.runners.parentrunner.access$000 (parentrunner.java:58) at Org.junit.runners.parentrunner$2.evaluate ( parentrunner.java:268) at Org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate ( RUNBEFORETESTCLASSCALLBACKS.JAVA:61) at Org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate ( RUNAFTERTESTCLASSCALLBACKS.JAVA:70) at Org.junit.runners.ParentRunner.run (parentrunner.java:363) at Org.springframework.tesT.context.junit4.springjunit4classrunner.run (springjunit4classrunner.java:191) at Org.junit.runner.JUnitCore.run (junitcore.java:137) at Com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs (Junit4ideatestrunner.java :) at Com.intellij.rt.execution.junit.ideatestrunner$repeater.startrunnerwithargs (IdeaTestRunner.java:47) at Com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart (junitstarter.java:242) at Com.intellij.rt.execution.junit.JUnitStarter.main (junitstarter.java:70) caused by: Org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' entitymanagerfactory ' defined In class path resource [Org/springframework/boot/autoconfigure/orm/jpa/hibernatejpaautoconfiguration.class]: Invocation of Init method failed; Nested exception is org.hibernate.AnnotationException:No identifier specified for entity: Com.jyhd.cardhouse.admin.entity.Menuat Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (Abstractautowirecapablebeanfactory.java:1628) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:555) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:483) at org.springframework.beans.factory.support.abstractbeanfactory$1. GetObject (abstractbeanfactory.java:306) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:230) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:302) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:197) at Org.springframework.context.support.AbstractApplicationContext.getBean (abstractapplicationcontext.java:1080) at Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization ( abstractapplicationcontext.java:857) at ORG.SPRINGFRamework.context.support.AbstractApplicationContext.refresh (abstractapplicationcontext.java:543) 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.test.context.SpringBootContextLoader.loadContext (springbootcontextloader.java:120) at Org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal ( DEFAULTCACHEAWARECONTEXTLOADERDELEGATE.JAVA:98) at Org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext ( defaultcacheawarecontextloaderdelegate.java:116) ... morecaused by:org.hibernate.AnnotationException:No identifier specified for entity: Com.jyhd.cardhouse.admin.entity.Menuat Org.hibernate.cfg.InheritanceState.determineDefaultAccessType ( inheritancestate.java:265) at org.hibernate.cfg.inheritancestate.gEtelementstoprocess (inheritancestate.java:211) at Org.hibernate.cfg.AnnotationBinder.bindClass ( annotationbinder.java:717) at Org.hibernate.boot.model.source.internal.annotations.AnnotationMetadataSourceProcessorImpl.processEntityHierarchies (annotationmetadatasourceprocessorimpl.java:245) at org.hibernate.boot.model.process.spi.MetadataBuildingProcess $1.processentityhierarchies (metadatabuildingprocess.java:222) at Org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete (metadatabuildingprocess.java:265) at Org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata (Entitymanagerfactorybuilderimpl.java : 847) at Org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build ( entitymanagerfactorybuilderimpl.java:874) at Org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory ( SPRINGHIBERNATEJPAPERSISTENCEPROVIDER.JAVA:60) at Org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory (localcontainerentitymanagerfactorybean.java:360) at Org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory ( abstractentitymanagerfactorybean.java:382) at Org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet ( abstractentitymanagerfactorybean.java:371) at Org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet ( localcontainerentitymanagerfactorybean.java:336) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1687) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1624) ... More
Solutions
Springboot No Identifier specified for entity solution