Router functions are actually available without ApplicationContext for very small footprint applications, but UrlBasedViewResolver calls getApplicationContext().getAutowireCapableBeanFactory().
This causes NullPointerException if i use router functions and freemaker without ApplicationContext.
This has effectively been dealt with as part of #20099 already, conditionally using the ApplicationContext when available in both variants of UrlBasedViewResolver (in spring-webmvc as well as spring-webflux).
Additionally, I've moved the ApplicationContext field down from ViewResolverSupport to UrlBasedViewResolver since it's only really meant to be used for View class initialization there, leaving ViewResolverSupport as a more generic view property holder.
Toshiaki Maki opened SPR-15219 and commented
Router functions are actually available without
ApplicationContext
for very small footprint applications, butUrlBasedViewResolver
callsgetApplicationContext().getAutowireCapableBeanFactory()
.This causes
NullPointerException
if i use router functions and freemaker withoutApplicationContext
.spring-framework/spring-webflux/src/main/java/org/springframework/web/reactive/result/view/UrlBasedViewResolver.java
Lines 250 to 252 in fafd2d2
I'd be happy if these are decoupled.
Easiest way might be using
lifecycleMethods
as aBiFunction
like following:I'm using this hack as a workarround.
https://github.com/making/ik.am/tree/622b1c289ea4273210d4bc0a1a905fa890e8b1b7/src/main/java/am/ik/FreeMarkerConfig.java
https://github.com/making/ik.am/blob/622b1c289ea4273210d4bc0a1a905fa890e8b1b7/src/main/java/org/springframework/web/reactive/result/view/UrlBasedViewResolver.java
Affects: 5.0 M4
Issue Links:
Referenced from: commits 14161d1
1 votes, 3 watchers
The text was updated successfully, but these errors were encountered: