Spring RestTemplate dependency issue in Ear

116 Views Asked by At

The organisation I work for has a few standalone services using Spring Boot and RestTemplate to communicate with each other and the main monolith (classical skinny War in Ear).

However, we are running into problems with the classpath when we try to get RestTemplate running inside the Ear, but not inside the War. We don't consider making a rest call to be part of the web application, so we moved that code up to a library which gets packaged in EAR/lib. This moved spring-web (4.1.6.RELEASE) to EAR/lib as well, at which point WebApplicationInitializer code stops working.

Is there are way to get the application still kickstarted with spring-web inside EAR/lib rather than WEB-INF/lib? Or should we resign ourselves to either using RestTemplate exclusively in the War/finding an alternative to RestTemplate?

1

There are 1 best solutions below

0
On BEST ANSWER

Never mind, apparently when spring-web isn't deployed in WEB-INF/lib, WebApplicationInitializers don't work. We can work around that.