title: Spring Boot REST Controller doesn't work after setting attribute with custom xml bean
body: <p>I am learning Spring framework (more generally Java EE).</p>
  
  <p>I like the feature of passing the configuration using xml files. I started by the <a href="http://spring.io/guides/gs/rest-service/" rel="nofollow">this</a> example and it worked fine.</p>
  
  <p>The only problem is that once I add my custom xml configuration with beans to set the attribute value inside the controller it doesn't work anymore, in the server log file it says <code>Caused by: java.lang.IllegalStateException: Ambiguous mapping found. Cannot map 'com.example.controller.FirstController#0' bean method (...)</code> then it lists all the methods in the controller exactly like if I defined multiple methods with identical RequestMapping (which is not the case).</p>
  
  <p>I wanted to set a single attribute, but it seems that because of that the entire autoconfiguration doesn't work anymore.</p>
  
  <h2>Before</h2>
  
  <p>Main class</p>
  
  <pre><code>@Configuration
  @ComponentScan
  @EnableAutoConfiguration
  public class MainApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(MainApplication.class, args);
      }
  }
  </code></pre>
  
  <p>Controller class</p>
  
  <pre><code>@RestController
  @RequestMapping("first")
  public class FirstController {
      protected final Logger log = LoggerFactory.getLogger(getClass());
  
      @RequestMapping("test")
      public String test() {
          log.info("Test");
          return "OK";
      }
  }
  </code></pre>
  
  <h2>After</h2>
  
  <p>Main class</p>
  
  <pre><code>@Configuration
  @ComponentScan
  @EnableAutoConfiguration
  @ImportResource("classpath:config.xml")
  public class MainApplication {
  
      public static void main(String[] args) {
          SpringApplication.run(MainApplication.class, args);
      }
  }
  </code></pre>
  
  <p>Controller class</p>
  
  <pre><code>@RestController
  @RequestMapping("first")
  public class FirstController {
      protected final Logger log = LoggerFactory.getLogger(getClass());
  
      private String testingbean;
      public void setTestingbean(String testingbean) {
          this.testingbean = testingbean;
      }
  
      @RequestMapping("test")
      public String test() {
          log.info("Test");
          return "OK";
      }
  
      @RequestMapping("beantest")
      public String testBeans() {
          return testingbean;
      }
  }
  </code></pre>
  
  <p>Config.xml file</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"
      xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt;
  
      &lt;!-- test bean --&gt;
      &lt;bean class="com.example.controller.FirstController"&gt;
          &lt;property name="testingbean" value="works"/&gt;
      &lt;/bean&gt;
  &lt;/beans&gt;
  </code></pre>
  
  <p>In the <code>Before</code> version after accessing /first/test it returned <code>OK</code>, now I get blank page and <code>Ambiguous mapping found</code> error in the log file.</p>
  
  <p>Could someone explain to me how to mix Spring Boot autoconfiguration with custom defined beans?</p>