java.lang.StackOverflowError: null at org.springframework.data.util.TypeDiscoverer.createInfo(TypeDiscoverer.java:113) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.TypeDiscoverer.getSuperTypeInformation(TypeDiscoverer.java:443) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.ClassTypeInformation.getSuperTypeInformation(ClassTypeInformation.java:42) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.TypeDiscoverer.getSuperTypeInformation(TypeDiscoverer.java:449) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.ClassTypeInformation.getSuperTypeInformation(ClassTypeInformation.java:42) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.TypeDiscoverer.getSuperTypeInformation(TypeDiscoverer.java:449) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.ClassTypeInformation.getSuperTypeInformation(ClassTypeInformation.java:42) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.TypeDiscoverer.getSuperTypeInformation(TypeDiscoverer.java:449) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.ClassTypeInformation.getSuperTypeInformation(ClassTypeInformation.java:42) ~[spring-data-commons-2.5.1.jar:2.5.1] at org.springframework.data.util.TypeDiscoverer.getSuperTypeInformation(TypeDiscoverer.java:449) ~[spring-data-commons-2.5.1.jar:2.5.1] ...
default TypeInformation<?> getRequiredSuperTypeInformation(Class<?> superType) { TypeInformation<?> result = getSuperTypeInformation(superType); if (result == null) { thrownewIllegalArgumentException(String.format( "Can't retrieve super type information for %s! Does current type really implement the given one?", superType)); } return result; }
很明显,这里没有递归。所以问题应该就是因为
1
TypeInformation<?> result = getSuperTypeInformation(superType);