Guest User

Untitled

a guest
Dec 22nd, 2018
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.83 KB | None | 0 0
  1. Description:
  2. Field userRepository in com.fitness.api.controller.UserController required a bean named 'entityManagerFactory' that could not be found.
  3.  
  4. Action:
  5. Consider defining a bean named 'entityManagerFactory' in your configuration.
  6.  
  7. package com.test.api;
  8.  
  9. import org.springframework.boot.SpringApplication;
  10. import org.springframework.boot.autoconfigure.SpringBootApplication;
  11. import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  12.  
  13. @EnableJpaRepositories("com.test.api.repository")
  14. @SpringBootApplication
  15. public class ApiApplication {
  16.  
  17. public static void main(String[] args) {
  18. SpringApplication.run(ApiApplication.class, args);
  19. }
  20. }
  21.  
  22. spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
  23.  
  24. ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
  25. # MySQL properties
  26. spring.datasource.url = jdbc:mysql://localhost:3306/test?useSSL=false
  27. spring.datasource.username = root
  28. spring.datasource.password = 1234
  29.  
  30. ## Hibernate Properties
  31. # The SQL dialect makes Hibernate generate better SQL for the chosen database
  32. spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
  33.  
  34. # Hibernate ddl auto (create, create-drop, validate, update)
  35. spring.jpa.hibernate.ddl-auto = update
  36.  
  37. buildscript {
  38. ext {
  39. springBootVersion = '2.1.0.RELEASE'
  40. }
  41. repositories {
  42. mavenCentral()
  43. }
  44. dependencies {
  45. classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
  46. }
  47. }
  48.  
  49. apply plugin: 'java'
  50. apply plugin: 'eclipse'
  51. apply plugin: 'org.springframework.boot'
  52. apply plugin: 'io.spring.dependency-management'
  53.  
  54. group = 'com.test'
  55. version = '0.0.1-SNAPSHOT'
  56. sourceCompatibility = 1.8
  57.  
  58. repositories {
  59. mavenCentral()
  60. }
  61.  
  62.  
  63. dependencies {
  64. implementation('org.springframework.boot:spring-boot-starter-data-jpa')
  65. implementation('org.springframework.boot:spring-boot-starter-mustache')
  66. implementation('org.springframework.boot:spring-boot-starter-web')
  67. runtimeOnly('org.springframework.boot:spring-boot-devtools')
  68. runtimeOnly('mysql:mysql-connector-java')
  69. testImplementation('org.springframework.boot:spring-boot-starter-test')
  70. }
  71.  
  72. package com.test.api.models;
  73.  
  74. import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
  75. import org.springframework.data.annotation.CreatedDate;
  76. import org.springframework.data.annotation.LastModifiedDate;
  77. import org.springframework.data.jpa.domain.support.AuditingEntityListener;
  78.  
  79. import javax.persistence.*;
  80. import javax.validation.constraints.Email;
  81. import javax.validation.constraints.NotBlank;
  82. import java.io.Serializable;
  83. import java.util.Date;
  84.  
  85. @Entity
  86. @Table(name = "user")
  87. @EntityListeners(AuditingEntityListener.class)
  88. @JsonIgnoreProperties(value = {"createdAt", "updatedAt"},
  89. allowGetters = true)
  90. public class User implements Serializable {
  91. }
Add Comment
Please, Sign In to add comment