title: Spring @JsonIgnore not working
body: <p>How can I get @JsonIgnore to work I have a class. And even if I put the annotation there it has no effect on the output. I am using Jackson.</p>
  
  <pre><code>public class QuestionBlock implements ComparableByID{
  
  
      int ID;
  
      String title;
      String description;
      boolean deleted;
      boolean isDraft;
      boolean visible;
      Timestamp modifiedDate;
      String modifiedBy;
  
  
      private List&lt;Question&gt; questions =  new ArrayList&lt;&gt;();
  
      @JsonIgnore
      private List&lt;Survey&gt; surveys =  new ArrayList&lt;&gt;();
  
      ...
  
      @JsonIgnore
      public List&lt;Survey&gt; getSurveys() {
          return surveys;
      }
  
      @JsonIgnore
      public void setSurveys(List&lt;Survey&gt; surveys) {
          this.surveys = surveys;
      }
  
  }
  </code></pre>
  
  <p>This is my Controller method:</p>
  
  <pre><code>@RequestMapping(value = "/questionBlock/{id}",produces = "application/json;charset=UTF-8")
      @ResponseBody
      public QuestionBlock getQuestionBlock(@PathVariable("id") int id) {
          return surveyService.getQuestionBlock(id);
      }
  </code></pre>
  
  <p>Here is my servlet-context.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
      xmlns:beans="http://www.springframework.org/schema/beans"
      xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
      xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd"&gt;
  
      &lt;mvc:annotation-driven /&gt;
  
  
      &lt;mvc:resources mapping="/resources/**" location="/resources/" /&gt;
      &lt;mvc:resources location="/, classpath:/META-INF/web-resources/"
          mapping="/resources/**" /&gt;
  
      &lt;context:property-placeholder location="classpath*:META-INF/*.properties" /&gt;
  
  
      &lt;context:component-scan base-package="com.adam.czibere" /&gt;
  
  
  
      &lt;bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="myDataSource" name="dataSource"&gt;
          &lt;property name="driverClassName" value="${database.driverClassName}" /&gt;
          &lt;property name="url" value="${database.url}" /&gt;
          &lt;property name="username" value="${database.username}" /&gt;
          &lt;property name="password" value="${database.password}" /&gt;
          &lt;property name="testOnBorrow" value="true" /&gt;
          &lt;property name="testOnReturn" value="true" /&gt;
          &lt;property name="testWhileIdle" value="true" /&gt;
          &lt;property name="timeBetweenEvictionRunsMillis" value="1800000" /&gt;
          &lt;property name="numTestsPerEvictionRun" value="3" /&gt;
          &lt;property name="minEvictableIdleTimeMillis" value="1800000" /&gt;
          &lt;property name="validationQuery" value="SELECT 1" /&gt;
      &lt;/bean&gt;
  
  
      &lt;bean id="mySessionFactory"
          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"&gt;
          &lt;property name="dataSource" ref="myDataSource" /&gt;
          &lt;property name="packagesToScan"&gt;
              &lt;array&gt;
                  &lt;value&gt;com.adam.czibere&lt;/value&gt;
              &lt;/array&gt;
          &lt;/property&gt;
          &lt;property name="hibernateProperties"&gt;
              &lt;value&gt;
                  hibernate.dialect=org.hibernate.dialect.MySQLDialect
              &lt;/value&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;bean id="transactionManager"
          class="org.springframework.orm.hibernate4.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="mySessionFactory" /&gt;
      &lt;/bean&gt;
  
  
      &lt;tx:annotation-driven transaction-manager="transactionManager"/&gt;
  
  &lt;bean
          class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
          &lt;property name="mediaTypes"&gt;
              &lt;map&gt;
                  &lt;entry key="html" value="text/html" /&gt;
                  &lt;entry key="json" value="application/json" /&gt;
              &lt;/map&gt;
          &lt;/property&gt;
          &lt;property name="viewResolvers"&gt;
              &lt;list&gt;
                  &lt;bean
                      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
                      &lt;property name="prefix" value="/WEB-INF/views/" /&gt;
                      &lt;property name="suffix" value=".jsp" /&gt;
                  &lt;/bean&gt;
              &lt;/list&gt;
          &lt;/property&gt;
          &lt;property name="defaultViews"&gt;
              &lt;list&gt;
                  &lt;bean
                      class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"&gt;
                      &lt;property name="prefixJson" value="false" /&gt;
                      &lt;property name="objectMapper" ref="jacksonObjectMapper" /&gt;
                  &lt;/bean&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
      &lt;bean id="jacksonObjectMapper" class="org.codehaus.jackson.map.ObjectMapper" /&gt;
      &lt;bean
          class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt;
          &lt;property name="messageConverters"&gt;
              &lt;list&gt;
                  &lt;bean
                      class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"&gt;
                      &lt;property name="prefixJson" value="false" /&gt;
                      &lt;property name="supportedMediaTypes" value="application/json" /&gt;
                  &lt;/bean&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>