When including springboot-devtools in my java applications, CXF JAX-WS clients being initialized with XML config were stopped working since address being populated with the ${placeholder}
instead of real value defined in properties.
For me, this is caused by DevToolsDataSourceAutoConfiguration
which is calling org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForType(Class<?>)
(line 164), making eagerInit called before properties are parsed.
Currently under Java 8 using SpringBoot 2.0.9 (Spring 5.0.13). Same code exists in current github code.
Could you please provide a fix for this. Adding the following gives me a fix but I don't want to add this on every java app...
@SpringBootApplication(exclude = { org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration.class })
Comment From: wilkinsona
Thanks for the report. We may be able to change to getBeanNamesForType(Class, boolean, boolean)
, but before doing so we'd need to fully understand the problem that we're trying to fix. To that end, can you please provide a minimal sample that reproduces the problem?
Comment From: laurentschoelens
@wilkinsona Thanks for the quick answer. I'll try create a sample for you if possible and attach it to the issue. The point is : DevToolsDataSourceAutoConfiguration is calling a method that triggers init of XML jaxws-beans that were imported by Java Config class.
At runtine, those jaxws-beans have address = ${placeholder.for.ws.url}, instead of having their substitutions, and having an exception in CXF : java.net.URISyntaxException: Illegal character in path at index 1: ${placeholder.for.ws.url}
Comment From: wilkinsona
Thanks. I understand the symptom of the problem. What I do not fully understand is its cause. The requested sample should help with that.
Comment From: laurentschoelens
Here's a sample Having 2 applications to launch (the one working with exclude is suffixed by 'Fixed')
Hope it'll help demo-issue20430.zip
Comment From: laurentschoelens
@wilkinsona : My first analysis was based on the following Breakpoint : org.apache.cxf.endpoint.AbstractEndpointFactory.setAddress(String)
which was initiated by the DevToolsDataSourceAutoConfiguration
which was calling org.springframework.beans.factory.ListableBeanFactory.getBeanNamesForType(Class<?>)
Comment From: wilkinsona
Thanks very much for the sample, @laurentschoelens.
Comment From: laurentschoelens
@wilkinsona : no problem :) This confort me that my app was not the cause of this bug.
I'm using SB 2.0.X, will it be possible to backport this fix in 2.0 / 2.1 ? If not, can I use DevTools fixed version with SB 2.0 ?
Thanks
Comment From: wilkinsona
Spring Boot 2.0.x each reached the end of its supported life so please upgrade as soon as possible. Support for 2.1.x is starting to wind down so upgrading to 2.2.x is recommended at this point.
Given that there's a workaround for this problem (excluding the auto-configuration), I have only fixed it in 2.2.x and master. You should not try to use DevTools from Spring Boot 2.2.x with earlier versions of Spring Boot. Upgrading from 2.0.x is your only supported option to pick up the fix. In the meantime, you could continue to use your workaround.