When I try to render my view in Thymeleaf I get an error Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E: Property or field 'currentTemperature' cannot be found on object of type 'reactor.core.publisher.MonoMapFuseable' - maybe not public or not valid?
The Spring WebFlux documentation states "model attributes that have a reactive type wrapper are resolved to their actual values", but passing a Mono<> to the view as a Model gives me the error above.
@RequestMapping(path = "/")
@GetMapping
public String home(Model model) {
Mono<ThermostatState> thermostatState = thermostatClient.fetchThermostatState();
model.addAttribute("thermostatState", thermostatState);
return "home";
}
Blocking the Mono<> and unwrapping the internal value makes the template render unchanged, but kinda eliminates the point of using the reactive libraries.
@RequestMapping(path = "/")
@GetMapping
public String home(Model model) {
Mono<ThermostatState> thermostatState = thermostatClient.fetchThermostatState();
ThermostatState unwrappedState = thermostatState.block();
model.addAttribute("thermostatState", unwrappedState);
return "home";
}
The project is entirely dependent on the spring starter dependencies and doesn't have an explicit configuration class.