title: SpringBoot org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping'
body: <p>I'm working on a springboot project on netbeans. 
  I'm getting the following exception : </p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'employeRestService' method 
  com.proj_web.controller.EmployeRestService#deleteMany(Long)
  to {DELETE /listEmploye/{id}}: There is already 'employeRestService' bean method
  com.proj_web.controller.EmployeRestService#delete(Long) mapped.
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:879) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.4.RELEASE.jar:2.2.4.RELEASE]
      at com.proj_web.ProjWebApplication.main(ProjWebApplication.java:21) [classes/:na]
  Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'employeRestService' method 
  com.proj_web.controller.EmployeRestService#deleteMany(Long)
  to {DELETE /listEmploye/{id}}: There is already 'employeRestService' bean method
  com.proj_web.controller.EmployeRestService#delete(Long) mapped.
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.validateMethodMapping(AbstractHandlerMethodMapping.java:632) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry.register(AbstractHandlerMethodMapping.java:599) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.registerHandlerMethod(AbstractHandlerMethodMapping.java:318) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.registerHandlerMethod(RequestMappingHandlerMapping.java:350) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.registerHandlerMethod(RequestMappingHandlerMapping.java:67) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.lambda$detectHandlerMethods$1(AbstractHandlerMethodMapping.java:288) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at java.util.LinkedHashMap.forEach(LinkedHashMap.java:676) ~[na:1.8.0_73]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:286) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.processCandidateBean(AbstractHandlerMethodMapping.java:258) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:217) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:205) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:171) ~[spring-webmvc-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
      ... 16 common frames omitted
  </code></pre>
  
  <p>I tried cleaning and building the project again, and I even updated maven yet it didn't work.</p>
  
  <p>edit : 
  EmployeRestService</p>
  
  <pre><code>
  package com.proj_web.controller;
  
  import com.dao.EmployeRepository;
  import com.entity.Employe;
  import org.springframework.web.bind.annotation.RestController;
  import org.springframework.web.bind.annotation.RequestMapping;
  import java.util.List;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.http.ResponseEntity;
  import org.springframework.web.bind.annotation.CrossOrigin;
  import org.springframework.web.bind.annotation.DeleteMapping;
  import org.springframework.web.bind.annotation.GetMapping;
  import org.springframework.web.bind.annotation.PathVariable;
  import org.springframework.web.bind.annotation.RequestBody;
  import org.springframework.web.bind.annotation.PostMapping;
  import org.springframework.web.bind.annotation.PutMapping;
  
  /**
   *
   * @author Nassim Bouhadouf &lt;Nassim.Bouhadouf at https://github.com/nassim-fox/&gt;
   */
  @RestController
  @CrossOrigin("*")
  public class EmployeRestService {
  
      @Autowired
      EmployeRepository employe_rep ; 
  
      @GetMapping()
      public List&lt;Object&gt; list() {
          return null;
      }
  
      @GetMapping("/listEmploye")
      public List &lt;Employe&gt; getListEmploye() {
          return employe_rep.findAll() ;
      }
  
      @GetMapping("/listEmploye/{id}")
      public Employe getEmploye(@PathVariable(name="id") Long id) {
          return employe_rep.findById(id).get() ;
      }
  
      @GetMapping("/listEmploye/search/{nom}")
      public List&lt;Employe&gt; getEmployeByNom(@PathVariable(name="nom") String nom) {
          return employe_rep.findByNom(nom) ;
      }
  
      @PutMapping("/listEmploye/{id}")
      public Employe updateEmp(@PathVariable(name="id") Long id, @RequestBody Employe emp) {
          emp.setId(id) ;
          return employe_rep.save(emp) ; 
      }
  
      @PostMapping("/listEmploye")
      public Employe save(@RequestBody Employe emp) {
          return employe_rep.save(emp) ;
      }
  
      @DeleteMapping(value="/listEmploye/{id}")
      public void delete(@PathVariable(name="id") Long id) {
           employe_rep.deleteById(id) ;
      }
  
      @DeleteMapping(value="/listEmploye/{id}")
      public void deleteMany(@PathVariable(name="id") Long id) {
           employe_rep.deleteById(id) ;
      }
  
      @PostMapping("/employeCreate/{num}")
      public void createMany(@PathVariable(name="num") Long num,@RequestBody Employe employe) 
      {
  
              int i  = 0 ; 
              while(i&lt;num)
              {
                  employe_rep.save(employe) ; 
                  i++ ; 
              }
  
      }
  
  
  }
  
  </code></pre>
  
  <p>please, can anyone guid me through this. 
  thanks.</p>