This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RESTful service in Spring configuration with jackson-datatype-jsr310  RSS feed

 
RichardH Marais
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I am trying to configure a Java 8 & Spring 4.3.1 app to use RESTful services.  I get it to work perfectly with the config below, until I introduce a ContextResolver. The reason for the ContextResolver is because I need to format a to JSON.

I first tried with annotations on my model bean by adding the @JsonFormat,



and got the following error:

java.lang.NoSuchMethodError: com.fasterxml.jackson.datatype.jsr310.ser.JSR310FormattedSerializerBase.findFormatOverrides(Lcom/fasterxml/jackson/databind/SerializerProvider;Lcom/fasterxml/jackson/databind/BeanProperty;Ljava/lang/Class;)Lcom/fasterxml/jackson/annotation/JsonFormat$Value;



Secondly, I removed the @JsonFormat annotation and tried with a ContextResolver,

ObjectMapperContextResolver.java


and got the following error:

[org.springframework.web.servlet.PageNotFound] (default task-4) No mapping found for HTTP request with URI [/jbosswildfly/employee/list] in DispatcherServlet with name 'rest'



Please can someone advise, I think my Spring configuration may not be correct.
  • In the first case, with the @JsonFormat annotation, the request hits the RESTful service, but gets a NoSuchMethodError suggesting my dependencies are not correct.
  • The second case, with the ContextResolver, the request doesn't find the DispatcherServelet (and hence doesn't reach the RESTful service). This suggests my Spring config is incorrect.

  • As I said, if I don't use the @JsonFormat annotation or the ContextResolver, I can call the RESTful service successfully (but I need to format the dates).

    Thank you


    My config as as follows:

    pom.xml



    web.xml



    rest-servlet.xml



     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!