title: Creating a custom view resolver in Spring MVC: Property 'url' is required
body: <p>I'm trying create a simple view resolver that returns hello world regardless of what view you want (as a starting point).</p>
  
  <p>I have this so far:</p>
  
  <pre><code>public class MyViewResolver extends AbstractTemplateView {
  
      @Override
      protected void renderMergedTemplateModel(Map&lt;String, Object&gt; model, HttpServletRequest request,
                                               HttpServletResponse response) throws Exception {
  
          doRender(model, request, response);
      }
  
      protected void doRender(Map&lt;String,Object&gt; model, HttpServletRequest request, HttpServletResponse response)
              throws Exception {
  
  
          PrintWriter writer = response.getWriter();
          writer.write("hi from my resolver!");
  
      }
  
  
  }
  </code></pre>
  
  <p>Now I am getting this error:</p>
  
  <pre><code>2012-03-29 16:51:28.855:WARN:/:unavailable
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in ServletContext resource [/WEB-INF/application-context.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'url' is required
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
  </code></pre>
  
  <p>I have implemented whatever the AbstractTemplateView required, not sure what url property it is asking for?</p>
  
  <p>Also, where is the name of the view that is passed to this viewresolver?</p>
  
  <p><b>Update</b></p>
  
  <p>So I added:</p>
  
  <pre><code> @Override
      public boolean isUrlRequired() {
          return false;
      }
  </code></pre>
  
  <p>And now I am just getting an error like:</p>
  
  <pre><code>HTTP ERROR 404
  
  Problem accessing /home/index. Reason:
  
      NOT_FOUND
  </code></pre>
  
  <p>My application-context.xml has:</p>
  
  <pre><code>&lt;bean id="viewResolver" class="com.example.MyViewResolver"&gt;
  
  &lt;/bean&gt;
  </code></pre>
  
  <p><strong>What am I missing something?</strong></p>