Announcement Announcement Module
Collapse
No announcement yet.
Format JodaTime LocalDate JSON Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Format JodaTime LocalDate JSON

    I have a problem with my Spring application.
    How can I format a LocalDate in a JSON...
    The problem is that when I send the JSON I have to send a number, but when Spring generate the JSON I have:
    Code:
    "data": {
        "weekyear": 1970,
        "weekOfWeekyear": 1,
        "chronology": {
            "zone": {
                "fixed": true,
                "id": "UTC"
            }
        },
        "monthOfYear": 1,
        "yearOfEra": 1970,
        ...and a lot more
    I have my field with the annotation DateTimeFormat like:
    Code:
    @DateTimeFormat(pattern="dd/MM/yyyy")
    private LocalDate data;
    And also configurated the format service in my servlet-context.xml:
    Code:
    <beans:bean id="conversionService"
          class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
          	<beans:property name="formatterRegistrars">
          		<beans:list>
          			<beans:bean class="org.springframework.format.datetime.joda.JodaTimeFormatterRegistrar" />
          		</beans:list>
          	</beans:property>
         </beans:bean>
    But this alone doesn't work, what I miss to configure?
Working...
X