Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.NoClassDefFoundError: org/springframework/data/repository/config/BootstrapMode

I'm doing this project with spring boot and I tried to write some tests but sadly I get this exception stacktrace:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [somepath/config/PostgresJpaConfig.class]; nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/config/BootstrapMode
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/repository/config/BootstrapMode

I looked if some sort of dependency was missing in my build.gradle, but I don't think so. The BootstrapMode thingy doesn't exist anywhere, not even on the Central Maven Repository. I searched through my entire project with IntelliJ for any type of BootstrapMode appearance, without any luck.

These are my gradle dependencies: Gradle Dependencies

This is my PostgrsJpaConfig class: PostgresJpaConfig class

like image 204
BlueScoreMan Avatar asked Oct 11 '18 08:10

BlueScoreMan


People also ask

Why doesn't spring-data-commons support bootstrapmode?

Your version of spring-data-commons is too old, and that version doesn't have the BootstrapMode class. Please try upgrading it to 2.2.0.RELEASE as you have for the other spring dependencies. It's probably a good idea to define a version property in your pom:

Is there a bootstrapmode dependency in my build Gradle?

I looked if some sort of dependency was missing in my build.gradle, but I don't think so. The BootstrapMode thingy doesn't exist anywhere, not even on the Central Maven Repository. I searched through my entire project with IntelliJ for any type of BootstrapMode appearance, without any luck.

Is there a bootstrapmode in IntelliJ?

The BootstrapMode thingy doesn't exist anywhere, not even on the Central Maven Repository. I searched through my entire project with IntelliJ for any type of BootstrapMode appearance, without any luck. Show activity on this post. TL;DR: I was mixing up Spring versions.

Is it possible to override one version of spring with another?

Overriding one version with another, which you shouldn't do. Instead of using the org.springframework.data dependency, I should use org.springframework.boot:spring-boot-starter-data-jpa.


1 Answers

TL;DR: I was mixing up Spring versions. Overriding one version with another, which you shouldn't do.

Instead of using the org.springframework.data dependency, I should use org.springframework.boot:spring-boot-starter-data-jpa.

like image 180
BlueScoreMan Avatar answered Sep 28 '22 06:09

BlueScoreMan