Open alexrsmith-FS opened 1 year ago
I've run into exactly the same issue - in our case we are using Joda time, and on upgrading to Spring Boot 2.7.8 we are getting the helpful error message that we should install Joda time support for ObjectMapper, ... but of course it is installed, it seems that Thymeleaf team are not supporting it. Again its because the ObjectMapper is private and inaccessible.
@dstrawson
You're likely completely out of luck for attempting to serialize your Joda Time objects directly to JS in thymeleaf. Here's some options I can thinking of.
@RestController
. So you'd need to write up an endpoint in your js that executes on page load.Good luck!
I'm using Thymeleaf 3.0.15 with Spring Boot 2.7 which includes JPA and Hibernate.
I ran into this problem when attempting to add support for serialization of HibernateProxy objects using the jackson.datatype.Hibernate5Module. I should have been able to declare this as a @Bean on some @Configuration, then Jackson's AutoConfiguration would have picked this up. But I discovered that Thymeleaf itself instantiates it's own ObjectMapper when it serializes. It does this at org.thymeleaf.standard.serializer.StandardJavaScriptSerializer.JacksonStandardJavaScriptSerializer.
This makes it so that Jackon's AutoConfiguration is completely bypassed. In my opinion, because this is a sping specific thymeleaf module. The ObjectMapper that is used should default to looking for a @Bean, then instantiate one for itself it a @Bean has not been defined.