0
대담한 방법으로 API 문서를 작성하려고합니다.스프링 대충 : 매핑이 없습니다.
- 메이븐 에 패키지를 추가 : 내가 지시 here을 따라
- 구성 Java 클래스를 만들었습니다
SwaggerConfig
(스프링 용 Java 구성 만 사용) - resou 추가
WebMvcConfigurerAdapter
@Controller
@RequestMapping("/mymapping")
public class ParameterController {
@Autowired
Mydao myDao;
/**
* GET list
*
* @return The resulting string
*/
//produces replaced accept-header
@RequestMapping(value="/Parameter", method=RequestMethod.GET, produces={MediaType.APPLICATION_JSON_UTF8_VALUE, "application/ld+json"})
public @ResponseBody List<String> getAllParameters() {
List<String> params= myDao.getAllParameters();
return params;
}
}
자신감을 configurate하려면 다음과 같이
내 REST API는 봄과 일반적인 컨트롤러의 도움으로 작성 본다
을 확장 같은 클래스의 @ComponentScan
주석에 WebMvcConfigurerAdapter
16:43:43,370 WARN qtp1072754634-13 servlet.PageNotFound:1136 - No mapping found for HTTP request with URI [/spring-security-rest/api/v2/api-docs] in DispatcherServlet with name 'org.springframework.web.servlet.DispatcherServlet-437a7f13'
시스템은 컨트롤러의 매핑 중에서 /spring-security-rest/api/v2/api-docs
경로를 검색합니다. 그리고 그것을 찾지 못한다.
무엇을 잊었나요?
미리 감사드립니다. 이 같은
는 자신감에 특히 컨피그이 WebMvcConfigurerAdapter 또는는 컨트롤러도 작동합니다
는이 내
WebMvcConfigurerAdapter.addResourceHandlers
는 모습입니다? – user2957954모두에 대해 –
완전한 코드로 업데이트되었습니다. 이제 내 수업은 나처럼 보입니다. 하지만 여전히 컨트롤러의 매핑 중에서/spring-security-rest/api/v2/api-docs를 찾습니다. – user2957954