Advertisement
Guest User

Untitled

a guest
Jan 28th, 2017
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.84 KB | None | 0 0
  1. ***************************
  2. APPLICATION FAILED TO START
  3. ***************************
  4. Description:
  5. Field repo in org.bluedolphin.spring.data.mysql.ActorController required a bean named 'entityManagerFactory' that could not be found.
  6. Action:
  7. Consider defining a bean named 'entityManagerFactory' in your configuration.
  8.  
  9. @EnableJpaRepositories(basePackages="org.bluedolphin.spring.data.mysql", entityManagerFactoryRef="emf")
  10.  
  11. ***************************
  12. APPLICATION FAILED TO START
  13. ***************************
  14. Description:
  15. Field repo in org.bluedolphin.spring.data.mysql.ActorController required a bean named 'emf' that could not be found.
  16. Action:
  17. Consider defining a bean named 'emf' in your configuration.
  18.  
  19. #Server details
  20. server.port=8180
  21. # Replace with your connection string
  22. spring.datasource.url=jdbc:mysql://localhost:3307/sakila
  23. # Replace with your credentials
  24. spring.datasource.username=root
  25. spring.datasource.password=password
  26. spring.datasource.driverClassName=com.mysql.jdbc.Driver
  27.  
  28. @SpringBootApplication
  29. @EnableJpaRepositories(basePackages="org.bluedolphin.spring.data.mysql", entityManagerFactoryRef="emf")
  30. public class SpringDataMysqlApplication {
  31.  
  32. private static final Logger log = LoggerFactory.getLogger(SpringDataMysqlApplication.class);
  33.  
  34. public static void main(String[] args) {
  35. SpringApplication.run(SpringDataMysqlApplication.class, args);
  36. }
  37. }
  38.  
  39. @Entity
  40. @Table(name = "actor")
  41. public class Actor {
  42.  
  43. @Id
  44. @GeneratedValue(strategy=GenerationType.AUTO)
  45. private long id;
  46. private String first_name;
  47. private String last_name;
  48. private Date last_update;
  49.  
  50. public Actor(int id, String first_name, String last_name, Date last_update) {
  51. super();
  52. this.id = id;
  53. this.first_name = first_name;
  54. this.last_name = last_name;
  55. this.last_update = last_update;
  56. }
  57.  
  58. public Actor() {
  59. super();
  60. }
  61.  
  62.  
  63. public long getId() {
  64. return id;
  65. }
  66.  
  67. public void setId(long id) {
  68. this.id = id;
  69. }
  70.  
  71. public String getFirst_name() {
  72. return first_name;
  73. }
  74.  
  75. public void setFirst_name(String first_name) {
  76. this.first_name = first_name;
  77. }
  78.  
  79. public String getLast_name() {
  80. return last_name;
  81. }
  82.  
  83. public void setLast_name(String last_name) {
  84. this.last_name = last_name;
  85. }
  86.  
  87. public Date getLast_update() {
  88. return last_update;
  89. }
  90.  
  91. public void setLast_update(Date last_update) {
  92. this.last_update = last_update;
  93. }
  94.  
  95. @Override
  96. public String toString() {
  97. return "Actor [id=" + id + ", first_name=" + first_name + ", last_name=" + last_name + ", last_update="
  98. + last_update + "]";
  99. }
  100. }
  101.  
  102. public interface ActorRepository extends CrudRepository<Actor, Long> {
  103.  
  104. }
  105.  
  106. <?xml version="1.0" encoding="UTF-8"?>
  107. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  108. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  109. <modelVersion>4.0.0</modelVersion>
  110. <groupId>org.bluedolphin.spring.data.mysql</groupId>
  111. <artifactId>spring-data-mysql</artifactId>
  112. <version>0.0.1-SNAPSHOT</version>
  113. <packaging>jar</packaging>
  114. <name>spring-data-mysql</name>
  115. <description>spring-data-mysql</description>
  116. <parent>
  117. <groupId>org.springframework.boot</groupId>
  118. <artifactId>spring-boot-starter-parent</artifactId>
  119. <version>2.0.0.BUILD-SNAPSHOT</version>
  120. <relativePath/> <!-- lookup parent from repository -->
  121. </parent>
  122. <properties>
  123. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  124. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  125. <java.version>1.8</java.version>
  126. </properties>
  127. <dependencies>
  128. <dependency>
  129. <groupId>org.springframework.boot</groupId>
  130. <artifactId>spring-boot-starter-data-jpa</artifactId>
  131. </dependency>
  132. <dependency>
  133. <groupId>org.springframework.boot</groupId>
  134. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  135. </dependency>
  136. <dependency>
  137. <groupId>org.springframework.boot</groupId>
  138. <artifactId>spring-boot-starter-web</artifactId>
  139. </dependency>
  140. <dependency>
  141. <groupId>org.springframework.boot</groupId>
  142. <artifactId>spring-boot-starter-test</artifactId>
  143. <scope>test</scope>
  144. </dependency>
  145. </dependencies>
  146. <build>
  147. <plugins>
  148. <plugin>
  149. <groupId>org.springframework.boot</groupId>
  150. <artifactId>spring-boot-maven-plugin</artifactId>
  151. </plugin>
  152. </plugins>
  153. </build>
  154. <repositories>
  155. <repository>
  156. <id>spring-snapshots</id>
  157. <name>Spring Snapshots</name>
  158. <url>https://repo.spring.io/snapshot</url>
  159. <snapshots>
  160. <enabled>true</enabled>
  161. </snapshots>
  162. </repository>
  163. <repository>
  164. <id>spring-milestones</id>
  165. <name>Spring Milestones</name>
  166. <url>https://repo.spring.io/milestone</url>
  167. <snapshots>
  168. <enabled>false</enabled>
  169. </snapshots>
  170. </repository>
  171. </repositories>
  172. <pluginRepositories>
  173. <pluginRepository>
  174. <id>spring-snapshots</id>
  175. <name>Spring Snapshots</name>
  176. <url>https://repo.spring.io/snapshot</url>
  177. <snapshots>
  178. <enabled>true</enabled>
  179. </snapshots>
  180. </pluginRepository>
  181. <pluginRepository>
  182. <id>spring-milestones</id>
  183. <name>Spring Milestones</name>
  184. <url>https://repo.spring.io/milestone</url>
  185. <snapshots>
  186. <enabled>false</enabled>
  187. </snapshots>
  188. </pluginRepository>
  189. </pluginRepositories>
  190. </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement