0
1 개의 HTTP 요청 만 지원하는 REST 서버를 설정하려고합니다.java.lang.IllegalStateException : 모호한 매핑. 'VausRestController'메서드를 매핑 할 수 없습니다.
2017/05/10 16:42:46.036 ERROR:
Failed starting server: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'requestMappingHandlerMapping' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Ambiguous mapping. Cannot map 'VausRestController' method
public org.springframework.http.ResponseEntity<com.nds.ch.vge.vaus.restController.VausRestController$ErrorResponse> com.nds.ch.vge.vaus.restController.VausRestController.signature(com.nds.ch.vge.vaus.types.EcdsaSignature)
to {[/authentication/signature],methods=[PUT]}: There is already 'vausRestController' bean method
public org.springframework.http.ResponseEntity<com.nds.ch.vge.vaus.restController.VausRestController$ErrorResponse> com.nds.ch.vge.vaus.restController.VausRestController.signature(com.nds.ch.vge.vaus.types.EcdsaSignature) mapped.
응용 프로그램 컨텍스트 (관련 부분) : 나는 다음과 같은 예외를받은
<context:annotation-config />
<bean id="VausRestController" class="restController.VausRestController">
<property name="authenticationManager" ref="authenticationManager" />
</bean>
코드 : 나는 단지 하나의 @RequestMapping
이
import javax.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@Controller
@RestController
public class VausRestController {
@Resource(name="authenticationManager")
AuthenticationManager authenticationManager;
public void setAuthenticationManager(AuthenticationManager authenticationManager) {
this.authenticationManager = authenticationManager;
}
@RequestMapping(value ="/authentication/signature", method = RequestMethod.PUT)
public ResponseEntity<Object> signature(@RequestBody final EcdsaSignature ecdsaSignature) {
return ......
}
알 수 있습니다. 또한 내 pom.xml에서 스프링 버전을 변경하려고 시도했습니다. 도움이되지 않았습니다.
그냥 보조 노트 : 당신은 왜 빈을해야합니까를 전혀 정의? 컨텍스트를 주석 중심으로 설정할 수 있으므로 XML에서 Bean을 명시 적으로 지정할 필요가 없습니다. 게다가 XML 설정은 당신이 일반적으로하지 않거나 필드 주입이 아닌 생성자 주입으로 개인적으로 옮길 것입니다. http://olivergierke.de/2013/11/why-field-injection을 참조하십시오. -is-evil / –