[ RESOLVED ] Spring Test Error : Failed to load ApplicationContext - DevDummy

Latest

Coding Hacks, Shared ...

Thursday, September 21, 2017

[ RESOLVED ] Spring Test Error : Failed to load ApplicationContext

Spring/ Spring Boot Error while running Spring Tests




java.lang.IllegalStateException: Failed to load ApplicationContext
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:125)

......

Caused by: java.lang.NullPointerException: null
at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:60)

If you are seeing this error while running Spring Tests alone with Spring Boot in use, most probably this should be due to a dependency issue.

Especially it can be noticed when you are using a higher version of Spring Framework with an older version of Spring Boot.

Maven Dependencies occurring the issue

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>5.0.0.M3</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot</artifactId>
    <version>1.5.6.RELEASE</version>
</dependency>

Maven Dependencies resolving the issue


<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>5.0.0.M3</version>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot</artifactId>
    <version>2.0.0.M3</version>
</dependency>

Reference 

01. https://mvnrepository.com/artifact/org.springframework.boot/spring-boot/2.0.0.M3

No comments:

Post a Comment