title: "Cycle found" with Spring Data Mongo 1.5
body: <p>I have a project perfectly running with Spring Data MongoDB 1.4.2.
  I tried to update to 1.5.0 and I get this error during autowiring (extract) :</p>
  
  <blockquote>
    <p>Caused by: org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$CyclicPropertyReferenceException: <strong>Found cycle for field 'rules' in type 'Filter' for path 'filter.rules'</strong><br>
      at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$CycleGuard.protect(MongoPersistentEntityIndexResolver.java:370) ~[spring-data-mongodb-1.5.0.RELEASE.jar:na]<br>
      at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$2.doWithPersistentProperty(MongoPersistentEntityIndexResolver.java:144) ~[spring-data-mongodb-1.5.0.RELEASE.jar:na]<br>
      at org.springframework.data.mongodb.core.index.MongoPersistentEntityIndexResolver$2.doWithPersistentProperty(MongoPersistentEntityIndexResolver.java:138) ~[spring-data-mongodb-1.5.0.RELEASE.jar:na]<br>
      at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:294) ~[spring-data-commons-1.8.0.RELEASE.jar:na]</p>
  </blockquote>
  
  <p>I have a repository "RulesDAO" simply extending "MongoRepository". It manages an entity named "Rule". This entity has some basic fields and a "Filter" field. And this Filter class contains a list of Filter (which can be empty).</p>
  
  <pre><code>@Document(collection="rules")
  public class Rule {
  
      @Id private String id;
  
      private String name;
  
      // other fields
  
      private Filter filter;
  
  }
  
  public class Filter {
  
      // for groups
      private String condition;
  
      private List&lt;Filter&gt; rules = new ArrayList&lt;Filter&gt;();
  
  
      // for query
      private String field;
  
      private String value;
  
  }
  </code></pre>
  
  <p>("rules" is not a perfect name, but it has to be named this way for MVC binding)</p>
  
  <p>So the Filter.rules property is interpreted as a cycle where it isn't ! (well in my understanding of the term "cycle")</p>
  
  <p>Is it a bug in the release or is there a new "flag" for this usecase ?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p>For the background story, the Filter class can be either a leaf or a node of a tree used to build complex Criteria, it is builded from the JSON of a jQuery plugin of mines <a href="http://mistic100.github.io/jQuery-QueryBuilder" rel="noreferrer">http://mistic100.github.io/jQuery-QueryBuilder</a></p>