我的项目信息:
- 打开Java 11.01
- springdoc-openapi-ui 1.5.2
- 弹簧芯5.1.2.RELEASE
- 春季启动2.1.0.RELEASE
使用这个控制器而不实现这个接口,我可以生成这个API-doc:
@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();
}
I Have this error:
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注释迁移到接口等,但仍然是相同的错误。
我也有同样的错误
springBootVersion = 2.1.1.RELEASE
springdocVersion = 1.5.9
当我升级到
时,它就解决了springBootVersion = 2.1.3.RELEASE
所以这可能是Spring Boot错误或者Spring Boot依赖项中的错误