Question: How to set my own DateFormat?
I am want to set my own DateFormat, but I didn't find a way how to set.
ObjectMapperConfigurer is already added.
@Bean
public ObjectMapperConfigurer buildGraphqlServletObjectMapper() {
ObjectMapperConfigurer configurer = new ObjectMapperConfigurer() {
@Override
public void configure(ObjectMapper mapper) {
mapper.setDateFormat(new SimpleDateFormat(TimeUtils.DEFAULT_FORMAT));
}
};
return configurer;
}
But not work. BTW. I am using jackson to parse json.
Help me.
Here is the debug result of GraphqlServlet. Use a Map<String, Object> data to create a JSON response. So, my customer object mapper will not parse a not-date-like object use DateFormat.

Finally, I modify data type from java.util.Date to long. And, use getTime() method to put a timestamp value into resolver result.
This is not related to this library, but is basic GraphQL. You can use scalars for that, see the following links:
- https://graphql.org/learn/schema/#scalar-types
- https://www.graphql-java.com/documentation/v11/scalars/
- https://github.com/donbeave/graphql-java-datetime