title: StackOverflowError when starting spring-boot application
body: <p>In my spring-boot maven project, one of the dependencies is bringing <code>spring-data-commons</code>. That scans through the classes in my project and throws StackOverflow error. The class it doesn't like is the following,</p>
  
  <pre><code>class TreeNode&lt;T&gt; {
      private T someData = null;
      private List&lt;TreeNode&lt;T&gt;&gt; children = new ArrayList&lt;&gt;();
  }
  </code></pre>
  
  <p>I suppose it is trying some reflection mechanism on the fields and subsequently fails due to some indefinite loop.
  logs during spring-boot app start.</p>
  
  <pre><code>Caused by: java.lang.StackOverflowError
      at java.util.AbstractMap.hashCode(AbstractMap.java:528) ~[?:1.8.0_121]
      at org.springframework.util.ObjectUtils.nullSafeHashCode(ObjectUtils.java:396) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.core.ResolvableType.calculateHashCode(ResolvableType.java:865) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.core.ResolvableType.&lt;init&gt;(ResolvableType.java:140) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.core.ResolvableType.forType(ResolvableType.java:1349) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.core.ResolvableType.forType(ResolvableType.java:1320) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.core.GenericTypeResolver.resolveType(GenericTypeResolver.java:260) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.data.util.TypeDiscoverer.resolveType(TypeDiscoverer.java:186) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.util.TypeDiscoverer.createInfo(TypeDiscoverer.java:128) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.util.ParentTypeAwareTypeInformation.createInfo(ParentTypeAwareTypeInformation.java:73) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.util.TypeDiscoverer.getPropertyInformation(TypeDiscoverer.java:246) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.util.TypeDiscoverer.getProperty(TypeDiscoverer.java:221) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.util.ParentTypeAwareTypeInformation.getProperty(ParentTypeAwareTypeInformation.java:28) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.model.AbstractPersistentProperty.&lt;init&gt;(AbstractPersistentProperty.java:66) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.model.AnnotationBasedPersistentProperty.&lt;init&gt;(AnnotationBasedPersistentProperty.java:68) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.neo4j.mapping.Neo4jPersistentProperty.&lt;init&gt;(Neo4jPersistentProperty.java:74) ~[spring-data-neo4j-4.2.3.RELEASE.jar:?]
      at org.springframework.data.neo4j.mapping.Neo4jMappingContext.createPersistentProperty(Neo4jMappingContext.java:95) ~[spring-data-neo4j-4.2.3.RELEASE.jar:?]
      at org.springframework.data.neo4j.mapping.Neo4jMappingContext.createPersistentProperty(Neo4jMappingContext.java:42) ~[spring-data-neo4j-4.2.3.RELEASE.jar:?]
      at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:487) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:465) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:693) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:329) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:508) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:465) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.util.ReflectionUtils.doWithFields(ReflectionUtils.java:693) ~[spring-core-4.3.8.RELEASE.jar:4.3.8.RELEASE]
      at org.springframework.data.mapping.context.AbstractMappingContext.addPersistentEntity(AbstractMappingContext.java:329) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.createAndRegisterProperty(AbstractMappingContext.java:508) ~[spring-data-commons-1.13.3.RELEASE.jar:?]
      at org.springframework.data.mapping.context.AbstractMappingContext$PersistentPropertyCreator.doWith(AbstractMappingContext.java:465) ~[spring-data-common]s-1.13.3.RELEASE.jar:?
  </code></pre>
  
  <p>I don't want it to scan this class (or any class for that matter).I was not successful just removing <code>spring-data-commons</code>. as it used in other parts of my application to inject some session objects.</p>
  
  <p>Any suggestions to solve this problem? </p>
  
  <p>P.S: I'm not an expert in spring-data. But have been using spring for quite some time.</p>
  
  <p>Cheers!</p>