The root cause is
Caused by: java.lang.NoSuchMethodError: org.app.config.JpaConfiguration.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V
A NoSuchMethodError
almost always indicates that there is a versioning issue with your build. The application tries to execute a method that was available at compile time, but not at run time. In other words, the classpath at compilation is different than the classpath at run time.
spring-data-jpa
version 1.5.1.RELEASE
is compiled with Spring 3.2.8, but you're providing Spring libraries of 4.0.2.RELEASE
. However, it is built in a way that it will delegate to your project's actual dependencies if those exist. In your current setup, it will use the following
<artifactId>spring-context-support</artifactId>
<artifactId>spring-context</artifactId>
<artifactId>spring-jdbc</artifactId>
<artifactId>spring-orm</artifactId>
<artifactId>spring-tx</artifactId>
with version 4.0.2.RELEASE
, but it will use version 3.2.8.RELEASE
of
<artifactId>spring-core</artifactId>
<artifactId>spring-beans</artifactId>
These are typically dependencies of spring-context
with the same version, but here it seems they get overwritten by spring-data-jpa
.
The simplest, but maybe incomplete (depending on the rest of your configuration), is to specifically declare those two dependencies
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
So spring-data-jpa
will now delegate to these.
Alternatively, unless you are using some features of Spring 4.0.2.RELEASE
, you could get rid of all your other Spring dependencies and only keep spring-data-jpa
. It will be responsible for pulling the other Spring 3.2.8.RELEASE
libraries.