ConfigurationClassParser does not use ApplicationContext's ResourceLoader for its MetadataReaderFactory [SPR-14684] #19248
Comments
Juergen Hoeller commented
However, I'm surprised that this actually worked in 3.2.x! This is probably due to more defensive class loading in 4.x, making use of the In any case, we'll fix this for the upcoming 4.3.3. |
Denis Miorandi commented In spring 3.2.x app boot from web.xml, now from spring boot. It's possible this code (ConfigurationClassPostProcessor ) was not used on my previous version of sw, before upgrade to spring 4. |
Juergen Hoeller commented Alright, thanks for the clarification! I suppose a directly equivalent arrangement probably wouldn't have worked in 3.2.x either, so this isn't an immediate regression. In any case, we'll do our best to make this work in 4.3.3, scheduled for release late next week. |
Denis Miorandi commented ok tks Juergen |
Juergen Hoeller commented It would be great if you could give the latest |
Denis Miorandi commented I should able to test it this afgternoon or at least on tomorrow |
Denis Miorandi commented I'm using springboot 1.4 + some spring 4.3.2 deps. I've replaced/forced spring-core+spring-context to snapshot. |
Stéphane Nicoll commented Denis Miorandi you must replace the whole spring framework and not individual jars. If you are using the Alway run Or you can generate an app from |
Denis Miorandi commented Probably you means <spring.version>4.3.3.BUILD-SNAPSHOT</spring.version> not 4.3.2.. |
Denis Miorandi commented I've made test with full spring replacement 1.4.1.BUILD-SNAPSHOT + 4.3.3.BUILD-SNAPSHOT. Btw I've verified war file outcome and there was no contamination of older versions. Actually without my patch it doesn't solve the issue. |
Denis Miorandi opened SPR-14684 and commented
Scenario description:
I've got a spring webapp like this
(via custom classloader, not from jar)
this work fine in spring 3.2.x.
When migrated to spring 4.3.2 + spring boot 1.4, I've got an issue starting up.
In some cases it doesn't load file using the expected resourceLoader (classpath instead of expexted file)
The only changing is I've used a spring boot annotated class starting instead a web.xml one.
Issue:
If you look at attacched files (stack), it seems that spring scan two times
My ugly patch
Actually the only solution I found is to patch SimpleMetadataReaderFactory forcing my logic
{{
@Override
public MetadataReader getMetadataReader(String className) throws IOException {
String resourcePath = ResourceLoader.CLASSPATH_URL_PREFIX +
ClassUtils.convertClassNameToResourcePath(className) + ClassUtils.CLASS_FILE_SUFFIX;
Resource resource = this.resourceLoader.getResource(resourcePath);
}}
Affects: 4.3.2
Attachments:
Issue Links:
The text was updated successfully, but these errors were encountered: