关于我的项目的信息:
- 打开 Java 11.01
- springdoc-openapi-ui 1.5.2
- Spring 核心 5.1.2.RELEASE
- 春季启动 2.1.0.RELEASE
有了这个没有实现这个接口的控制器,我可以生成这个 API 文档:
@RestController
public class MissionApiImpl implements MissionApi {
@Override
@GetMapping("/test")
public ResponseEntity<Void> test() {
return new ResponseEntity( HttpStatus.OK );
}
}
生成的文档:
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":
[{"url":"http://localhost:9000/mgb/v6.0.0","description":"Generated server url"}],"paths":{"/test":
{"get":{"tags":["mission-api-impl"],"operationId":"test","responses":{"200":
{"description":"OK"}}}}},"components":{}}
但是有了这个界面:
public interface MissionApi {
ResponseEntity<Void> test();
}
我有这个错误:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at org.springframework.web.method.HandlerMethod$HandlerMethodParameter.getParameterAnnotations(HandlerMethod.java:430)
a
知道为什么吗?
我试图将这个 Getter 注释迁移到接口等,但仍然是同样的错误。