You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
private class ResultEntity<T> {
private String code;
private String message;
private T rows;
}
定义一个接口
@GetMapping("/test")
public ResultEntity<List<Map<String,String>>(){
return null;
}
这种情况下会报
Caused by: java.lang.ClassCastException: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to class java.lang.Class (sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl and java.lang.Class are in module java.base of loader 'bootstrap')
at com.github.ydoc.core.Core.deepObject(Core.java:135) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.strategy.AbstractStrategy.deepObject(AbstractStrategy.java:56) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.strategy.AbstractStrategy.baseResponse(AbstractStrategy.java:154) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.strategy.AbstractHandler.processResponse(AbstractHandler.java:46) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.strategy.AbstractHandler.init(AbstractHandler.java:36) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.handler.api.PostHandler.generateApi(PostHandler.java:18) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.handler.api.PostHandler.generateApi(PostHandler.java:11) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.StrategySelector.matchAndGenerateApi(StrategySelector.java:33) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.ScanApi.scan(ScanApi.java:111) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at com.github.ydoc.core.ScanApi.afterPropertiesSet(ScanApi.java:210) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.17.jar:5.3.17]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.17.jar:5.3.17]
... 16 common frames omitted
The text was updated successfully, but these errors were encountered:
如果返回结果是 泛型且嵌套List时,会报类型转换异常。
示例:
定义个ResultEntity 如下
定义一个接口
这种情况下会报
The text was updated successfully, but these errors were encountered: