The start of the first spring boot application started, and this is my main spring boot class ( Full code on github )
@EnableAutoConfiguration
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
And here is the pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I keep getting the error below. What am I missing to add? Why do I need to add a bean named 'entityManagerFactory'? and this is necessary even after using spring boot
My repo looks like this if it matters
public interface RegistrationRepo extends JpaRepository<User, Long> {
User findByEmail(String email);
}
. ____ _ __ _ _ / \ / '__ _ () _ __ __ _ \\\\ (() _ |' _ | '| |' / `| \\\\ \ / ) | |) | | | | | || (| |)))) '| ____ |. || ||| | __, | //// ========= | _ | =============== | ___ / = /// _ / :: spring Boot :: (v1.5.6.RELEASE)
2017-09-13 12: 48: 38.808 INFO 15361 --- [main] com.rightlink.RightLinkApplication: RightLinkApplication Admins-MacBook-Pro.local PID 15361 (/Users/sureshatta/Documents/workspace- sts-3.9.0.RELEASE/RightLink/target/classes, sureshatta /Users/sureshatta/Documents/workspace -sts-3.9.0.RELEASE/RightLink) 2017-09-13 12: 48: 38.811 INFO 15361 --- [main] com.rightlink.RightLinkApplication: , : 2017-09-13 12: 48: 38.865 INFO 15361 --- [main] ationConfigEmbeddedWebApplicationContext: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@120d6fe6: [Wed Sep 13 12:48:38 IST 2017]; 2017-09-13 12: 48: 40.380 INFO 15361 --- [main] s.b.c.e.t.TomcatEmbeddedServletContainer: Tomcat, (-): 8181 (http) 2017-09-13 12: 48: 40.402 INFO 15361 --- [] o.apache.catalina.core.StandardService: [Tomcat] 2017-09-13 12: 48: 40.403 INFO 15361 --- [] org.apache.catalina.core.StandardEngine: : Apache Tomcat/8.5.16 2017-09-13 12: 48: 40.566 INFO 15361 --- [ost-startStop-1] o.a.c.c.C. [Tomcat]. [Localhost]. [/]: spring WebApplicationContext 2017-09-13 12: 48: 40.567 INFO 15361 --- [ost-startStop-1] o.s.web.context.ContextLoader: Root WebApplicationContext: 1705 2017-09-13 12: 48: 40.743 INFO 15361 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean: : 'dispatcherServlet' [/] 2017-09-13 12: 48: 40.752 INFO 15361 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean: : 'characterEncodingFilter' to: [/] 2017-09-13 12: 48: 40.753 INFO 15361 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean: : 'hiddenHttpMethodFilter' to: [/] 2017-09-13 12: 48: 40.753 INFO 15361 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean: : 'httpPutFormContentFilter': [/] 2017-09-13 12: 48: 40.753 INFO 15361 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean: : 'requestContextFilter' : [/] 2017-09-13 12: 48: 40.844 WARN 15361 --- [main] ationConfigEmbeddedWebApplicationContext: , - : org.springframework.beans.factory.UnsatisfiedDependencyException: bean 'registerController': , regServices; - org.springframework.beans.factory.UnsatisfiedDependencyException: bean 'regService': , 'registrationRepo'; - org.springframework.beans.factory.BeanCreationException: bean 'registrationRepo': bean '( bean) # 43c67247' [org.springframework.orm.jpa.SharedEntityManagerCreator] bean "entityManager"; - org.springframework.beans.factory.BeanCreationException: bean '(internal bean) # 43c67247': bean 'entityManagerFactory' ; - org.springframework.beans.factory.NoSuchBeanDefinitionException: bean 'entityManagerFactory' 2017-09-13 12: 48: 40.849 INFO 15361 --- [] o.apache.catalina.core.StandardService: [Tomcat] 2017-09-13 12: 48: 40.903 INFO 15361 --- [main] utoConfigurationReportLoggingInitializer:
ApplicationContext. , "debug". 2017-09-13 12: 48: 40.975 15361 --- [] o.s.b.d.LoggingFailureAnalysisReporter:
:
Repo com.rightlink.services.RegistrationService bean 'entityManagerFactory', .
:
bean "entityManagerFactory" .
application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/Test
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.ddl-auto=update
server.port=8181
@Repository , @enableJpaRepositories . .