From 800285f30ce556f8b788ae4d0f5f9c55b8e9b486 Mon Sep 17 00:00:00 2001 From: Roshan Thomas Date: Fri, 11 Mar 2016 22:54:45 -0500 Subject: [PATCH] Content Negotiation Strategy --- spring-mvc-xml/pom.xml | 12 ++++ .../com/baeldung/spring/form/Employee.java | 60 ++++++++++--------- .../contentManagementWebMvcConfig.xml | 43 +++++++++++++ 3 files changed, 86 insertions(+), 29 deletions(-) create mode 100644 spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml diff --git a/spring-mvc-xml/pom.xml b/spring-mvc-xml/pom.xml index fc7deaad61..50cafb44b5 100644 --- a/spring-mvc-xml/pom.xml +++ b/spring-mvc-xml/pom.xml @@ -98,6 +98,18 @@ test + + + com.fasterxml.jackson.core + jackson-core + 2.1.2 + + + com.fasterxml.jackson.core + jackson-databind + 2.1.2 + + diff --git a/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Employee.java b/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Employee.java index f41496212f..1fc7b82123 100644 --- a/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Employee.java +++ b/spring-mvc-xml/src/main/java/com/baeldung/spring/form/Employee.java @@ -2,46 +2,48 @@ package com.baeldung.spring.form; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; +import javax.xml.bind.annotation.XmlRootElement; +@XmlRootElement public class Employee { - private long id; + private long id; - @NotNull - @Size(min = 1) - private String name; - @NotNull - @Size(min = 1) - private String contactNumber; + @NotNull + @Size(min = 1) + private String name; + @NotNull + @Size(min = 1) + private String contactNumber; - public Employee() { - super(); - } + public Employee() { + super(); + } - // + // - public String getName() { - return name; - } + public String getName() { + return name; + } - public void setName(final String name) { - this.name = name; - } + public void setName(final String name) { + this.name = name; + } - public long getId() { - return id; - } + public long getId() { + return id; + } - public void setId(final long id) { - this.id = id; - } + public void setId(final long id) { + this.id = id; + } - public String getContactNumber() { - return contactNumber; - } + public String getContactNumber() { + return contactNumber; + } - public void setContactNumber(final String contactNumber) { - this.contactNumber = contactNumber; - } + public void setContactNumber(final String contactNumber) { + this.contactNumber = contactNumber; + } } diff --git a/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml b/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml new file mode 100644 index 0000000000..0fcd85e399 --- /dev/null +++ b/spring-mvc-xml/src/main/resources/contentManagementWebMvcConfig.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file