title: Spring boot 2.0.4.RELEASE fetch eager by default
body: <p>I'm using spring boot with JPA ( hibernate ) , Before I move to spring boot I was using Spring data JPA with hibernate and the default is to load property values eagerly and to load collections lazily.</p>
  
  <p>in spring boot JPA the following is fetched eagerly by default why ? The roles will be returned inside the user but they should be null</p>
  
  <pre><code>@ManyToMany(cascade = CascadeType.ALL)
  @JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
  private Set&lt;Role&gt; roles;
  </code></pre>
  
  <p>That's the example I followed <a href="https://medium.com/@gustavo.ponce.ch/spring-boot-spring-mvc-spring-security-mysql-a5d8545d837d" rel="nofollow noreferrer">https://medium.com/@gustavo.ponce.ch/spring-boot-spring-mvc-spring-security-mysql-a5d8545d837d</a></p>
  
  <p>And the application.properties I have edited to the follow :</p>
  
  <pre><code># ===============================
  # = JPA / HIBERNATE
  # ===============================
  spring.jpa.show-sql = true
  spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
  spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
  
  # ==============================================================
  # = Spring Security / Queries for AuthenticationManagerBuilder
  # ==============================================================
  spring.queries.users-query=select email, password, active from user where email=?
  spring.queries.roles-query=select u.email, r.role from user u inner join user_role ur on(u.id=ur.user_id) inner join role r on(ur.role_id=r.id) where u.email=?
  </code></pre>
  
  <p>===========================================================================
  I have tried to add this relation in the user Entity :</p>
  
  <pre><code>@Entity
  @Table(name = "user")
  @Getter
  @Setter
  public class User {
  
      @OneToMany(mappedBy = "user")
      private List&lt;Test&gt; tests;
  }
  </code></pre>
  
  <p>the tests will be fetched eagerly in this :</p>
  
  <pre><code>@Transactional
  @Override
  public List&lt;User&gt; getAllUsers() {
          List&lt;User&gt;users=userRepository.findAll();
      return users;
  }
  </code></pre>
  
  <p>I can't find why this is default instead of lazy loading.</p>