Hello team, hope you are well.
We had issues after upgrading from spring boot v2.4.1 to v2.4.2 and we believed those issues will be solved in v2.4.4 - but does not look like the fix worked.
One of the things that broke down when we updated was that static resources where not available on our child-context, but instad were all on the root-context and we got
[WARN] o.s.w.s.PageNotFound [qtp2054758027-151] [...] - No mapping for GET /{our_context_path_here}/js/jquery-3.2.1.min.js
[WARN] o.s.w.s.PageNotFound [qtp2054758027-149] [...] - No mapping for GET /{our_context_path_here}/js/common.js
since our templates refer to @{__${contextRoot}__/js/jquery-3.2.1.min.js}
, where contextRoot
is path to our specific context.
We believed this was related to following bugs that were reported earlier:
https://github.com/spring-projects/spring-framework/issues/26561 https://github.com/spring-projects/spring-boot/issues/25113#issuecomment-778434896
The fix should have been released in v2.4.4 - which got available yesterday. We tried it out and we still facing the same issue - even if I see less PageNotFound
errors compared to in v2.4.2, it is still breaking the functionality.
If I check /actuator/mappings, in v2.4.1 -> ResourceHttpRequestHandler with classpath /static was available in every context in v2.4.4 -> ResourceHttpRequestHandler with classpath /static available only on root
Since those spring boot updates were minor versions, I take it that no breaking changes should have been introduced and this is not a result of some planned feature change.
I decided not to reopen the earlier created bug since maybe this issue is caused by something else.
Since it is important to us to keep context separated, we cannot put our resources on root context. The only reason we are updating - or trying to update - is because we need a newer Netty version. So an additional question to the issue above: can we just update Netty to 1.0.3 with keeping Spring Boot 2.4.1 and expect it to be fine?
Comment From: wilkinsona
@WolfAlexander Can you please provide a small sample that reproduces the problem? You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
can we just update Netty to 1.0.3 with keeping Spring Boot 2.4.1 and expect it to be fine?
Assuming that you mean Reactor Netty, yes you should be able to upgrade to 1.0.3 without problem. I'd recommend upgrading to Netty 4.1.60 at the same time.
Comment From: WolfAlexander
@wilkinsona, thanks for the quick response. We will then do the Reactor Netty update instead.
When it comes to an example: since it is company code, I cannot put it out anywhere - but I can potentially put something together that is separate and general.
Comment From: wilkinsona
Thanks. Something that's separate and general sounds good to me. Something that contains just enough code to reproduce the problem would be ideal.
Comment From: WolfAlexander
@wilkinsona got the test-project. bug-test.zip
So it works like following: when application is started, you go to http://localhost:8080/test-backoffice/test/bo.html, there will be a button and the idea is that when you click it, you should get a text printed below the button.
If you run with spring boot v.2.4.1 -> everything works fine If you run with spring boot v.2.4.4 -> it will not work and you will get an error in the application logs: "No mapping for GET /test-backoffice/js/jquery-3.2.1.min.js"
Comment From: wilkinsona
Thanks very much for the sample, @WolfAlexander. I've reproduced the problem.
In Spring Boot 2.4.1, the addition of resource handlers is performed by WebMvcAutoConfigurationAdapter
, a WebMvcConfigurer
. It's called when during refresh of both the parent and the child application contexts. In Spring Boot 2.4.2, the addition of resource handlers moved to EnableWebMvcConfiguration
, a DelegatingWebMvcConfiguration
. It is only called during the refresh of the parent context as the child has its own DelegatingWebMvcConfiguruation
.
Flagging for our next team meeting so that we can discuss an alternative approach.
Comment From: WolfAlexander
@wilkinsona, we will go with reactor-bom 2020.0.5 with is Netty core 1.0.5 and Netty 4.1.55 -> let me know if you have any knowledge that this is a bad combination with spring boot 2.4.1
Comment From: wilkinsona
If you're using Reactor Netty 1.0.5, I'd recommend using Netty 4.1.60 rather than 4.1.55 and that's the version that Reactor Netty 1.0.5 uses by default.