Advertisement
Guest User

Untitled

a guest
Feb 17th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.71 KB | None | 0 0
  1. 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.reactspringresttutorial.payroll.Employee
  2. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  3. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  4. at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  5. at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  6. at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  7. at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  8. at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  9. at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  10. at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  11. at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
  12. at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  13. at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  14. at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  15. at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  16. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  17. at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  18. at com.reactspringresttutorial.payroll.ReactAndSpringDataRestApplication.main(ReactAndSpringDataRestApplication.java:10) [classes/:na]
  19. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
  20. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
  21. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
  22. at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
  23. at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-1.5.10.RELEASE.jar:1.5.10.RELEASE]
  24.  
  25. <?xml version="1.0" encoding="UTF-8"?>
  26. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  27. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  28. <modelVersion>4.0.0</modelVersion>
  29.  
  30. <groupId>com.unicorn</groupId>
  31. <artifactId>react-spring-rest-tutorial</artifactId>
  32. <version>0.0.1-SNAPSHOT</version>
  33. <packaging>jar</packaging>
  34.  
  35. <name>react-spring-rest-tutorial</name>
  36. <description>Demo project for Spring Boot</description>
  37.  
  38. <parent>
  39. <groupId>org.springframework.boot</groupId>
  40. <artifactId>spring-boot-starter-parent</artifactId>
  41. <version>1.5.10.RELEASE</version>
  42. <relativePath/> <!-- lookup parent from repository -->
  43. </parent>
  44.  
  45. <properties>
  46. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  47. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  48. <java.version>1.8</java.version>
  49. </properties>
  50.  
  51. <dependencies>
  52. <dependency>
  53. <groupId>org.springframework.boot</groupId>
  54. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  55. </dependency>
  56. <dependency>
  57. <groupId>org.springframework.boot</groupId>
  58. <artifactId>spring-boot-starter-data-jpa</artifactId>
  59. </dependency>
  60. <dependency>
  61. <groupId>org.springframework.boot</groupId>
  62. <artifactId>spring-boot-starter-data-rest</artifactId>
  63. </dependency>
  64. <dependency>
  65. <groupId>org.springframework.boot</groupId>
  66. <artifactId>spring-boot-devtools</artifactId>
  67. </dependency>
  68. <dependency>
  69. <groupId>org.projectlombok</groupId>
  70. <artifactId>lombok</artifactId>
  71. </dependency>
  72. <dependency>
  73. <groupId>com.h2database</groupId>
  74. <artifactId>h2</artifactId>
  75. <scope>runtime</scope>
  76. </dependency>
  77. <dependency>
  78. <groupId>org.springframework.boot</groupId>
  79. <artifactId>spring-boot-starter-test</artifactId>
  80. <scope>test</scope>
  81. </dependency>
  82. </dependencies>
  83.  
  84. <build>
  85. <plugins>
  86. <plugin>
  87. <groupId>org.springframework.boot</groupId>
  88. <artifactId>spring-boot-maven-plugin</artifactId>
  89. </plugin>
  90. </plugins>
  91. </build>
  92.  
  93. @SpringBootApplication
  94. public class ReactAndSpringDataRestApplication {
  95.  
  96. public static void main(String[] args) {
  97. SpringApplication.run(ReactAndSpringDataRestApplication.class, args);
  98. }
  99. }
  100.  
  101. @Component
  102. public class DatabaseLoader implements CommandLineRunner{
  103.  
  104. private final EmployeeRepository repository;
  105.  
  106. @Autowired
  107. public DatabaseLoader(EmployeeRepository repository) {
  108. this.repository = repository;
  109. }
  110.  
  111. @Override
  112. public void run(String... strings) throws Exception {
  113. this.repository.save(new Employee("Frodo", "Baggins", "Ring bearer"));
  114. }
  115. }
  116.  
  117. public interface EmployeeRepository extends CrudRepository<Employee, Long> {}
  118.  
  119. @Data
  120. @Entity
  121. public class Employee {
  122.  
  123. private @Id @GeneratedValue Long id;
  124. private String firstName;
  125. private String lastName;
  126. private String description;
  127.  
  128. public Employee() {}
  129.  
  130. public Employee(String firstName, String lastName, String description) {
  131. this.firstName = firstName;
  132. this.lastName = lastName;
  133. this.description = description;
  134. }
  135. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement