Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Description:
- Field userRepository in com.fitness.api.controller.UserController required a bean named 'entityManagerFactory' that could not be found.
- Action:
- Consider defining a bean named 'entityManagerFactory' in your configuration.
- package com.test.api;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
- @EnableJpaRepositories("com.test.api.repository")
- @SpringBootApplication
- public class ApiApplication {
- public static void main(String[] args) {
- SpringApplication.run(ApiApplication.class, args);
- }
- }
- spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
- ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
- # MySQL properties
- spring.datasource.url = jdbc:mysql://localhost:3306/test?useSSL=false
- spring.datasource.username = root
- spring.datasource.password = 1234
- ## Hibernate Properties
- # The SQL dialect makes Hibernate generate better SQL for the chosen database
- spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
- # Hibernate ddl auto (create, create-drop, validate, update)
- spring.jpa.hibernate.ddl-auto = update
- buildscript {
- ext {
- springBootVersion = '2.1.0.RELEASE'
- }
- repositories {
- mavenCentral()
- }
- dependencies {
- classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
- }
- }
- apply plugin: 'java'
- apply plugin: 'eclipse'
- apply plugin: 'org.springframework.boot'
- apply plugin: 'io.spring.dependency-management'
- group = 'com.test'
- version = '0.0.1-SNAPSHOT'
- sourceCompatibility = 1.8
- repositories {
- mavenCentral()
- }
- dependencies {
- implementation('org.springframework.boot:spring-boot-starter-data-jpa')
- implementation('org.springframework.boot:spring-boot-starter-mustache')
- implementation('org.springframework.boot:spring-boot-starter-web')
- runtimeOnly('org.springframework.boot:spring-boot-devtools')
- runtimeOnly('mysql:mysql-connector-java')
- testImplementation('org.springframework.boot:spring-boot-starter-test')
- }
- package com.test.api.models;
- import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
- import org.springframework.data.annotation.CreatedDate;
- import org.springframework.data.annotation.LastModifiedDate;
- import org.springframework.data.jpa.domain.support.AuditingEntityListener;
- import javax.persistence.*;
- import javax.validation.constraints.Email;
- import javax.validation.constraints.NotBlank;
- import java.io.Serializable;
- import java.util.Date;
- @Entity
- @Table(name = "user")
- @EntityListeners(AuditingEntityListener.class)
- @JsonIgnoreProperties(value = {"createdAt", "updatedAt"},
- allowGetters = true)
- public class User implements Serializable {
- }
Add Comment
Please, Sign In to add comment