title: intellij and embedded Jetty - Error creating bean with name
body: <p><strong>TLDR</strong></p>
  
  <p>Getting error of <code>Error creating bean with name...</code> when running embedded Jetty within IntelliJ, but not when running the same code outside of Intellij - in a stand-alone Jetty server. </p>
  
  <p><strong>In-Depth</strong></p>
  
  <p>We have a web application that runs in a Jetty.</p>
  
  <p>Up until a week ago, I was able to start and use the app with the Intellij's embedded Jetty.</p>
  
  <p>A few days ago a colleague of mine updated one of the beans constructors and added to it a new bean that he created.</p>
  
  <p>So in the <code>zoowebappcontext.xml</code> he added a new entry to the bean constructor:</p>
  
  <pre><code> &lt;bean id="animalsService" class="java.util.ArrayList"&gt;
      &lt;constructor-arg&gt;
          &lt;list&gt;
              &lt;ref bean="pets.catService" /&gt;
              ....
              &lt;ref bean="pets.dogService" /&gt;  &lt;-- The new item
              ...
  </code></pre>
  
  <p>And in the <code>applicationContext.xml</code> file, he added a new bean definition, that looks very similar to all the other beans there:</p>
  
  <pre><code>    &lt;bean id="pets.dogService"
        class="com.example.DogServiceImpl"
        parent="..."&gt;
      &lt;property name="..." ref="..."/&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>The strange this is this: If I <code>mvn clean install</code> the project, have a new <code>zoo.war</code> , move it to the Jetty's <code>webapp</code> folder and start the app as a <strong>stand-alone Jetty</strong>, the app starts with no error.</p>
  
  <p>But, <strong>when running the app within the intellij's</strong> embedded Jetty, the app tries to start and eventually fails with this error:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'animalsService' defined in class path resource [zoowebappContext.xml]: Cannot resolve reference to bean 'pets.dogService' while setting constructor argument with key [14]; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'pets.dogSerice' is defined</p>
  </blockquote>
  
  <p>Moving the code to the commit before the above change, the intellij is able to start with no problems.</p>