Richard Chesterwood has his say

Richard's Blog

Spring Boot Crashing Due to Unsatisfied Depedency?

16-Oct-2016 in Errata Spring Boot

We've just had a report of a possible bug on our Microservices course - your web application might fail to start up with something like the following in the Stacktrace:

Launcher.java:49) [spring-boot-devtools-1.4.1.RELEASE.jar:1.4.1.RELEASE]
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'positionTrackingExternalService': Unsatisfied dependency expressed through field 'remoteService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creat...

This will happen if you use Spring boot 1.4 - the original course code used Boot 1.3.

So, as a quick (and unsatisfactory) fix, you can drop the version of boot down to 1.3. However, the root course appears to be classloader related (I haven't had time to fully investigate it, although the bug report here gives a big clue) and is triggered by the presence of the devtools dependency. We added that back on the first course to enable automatic container reloading.

Boot maintains two classloaders, and on a change to the code, it only needs to restart one - this is a speed optimisation. I have no idea why this break has happened in Boot 1.4, but if you have this problem, the solution is to remove the spring-boot-devtools dependency from your POM and all will be well. Of course, you'll now need to manually bounce the server each time you make changes.

If I get time to investigate this more thoroughly, I'll make further posts but hopefully for now this will stop anybody hitting a brick wall on the course!

Listen via:


About Richard

I'm a developer and trainer for Virtual Pair Programmers, where I present video based training courses on Java, Spring and associated frameworks. I don't wear ties anymore.


Be notified of new posts