title: Could not autowire SessionRegistry in spring boot
body: <p>I have spring boot application what migrated from spring application. Everything works fine. I decided to add some new functional which connected with SessionRegistry. And I found that sessionRegistry could not be autowired.
  It just displays Could not autowire. No beans of 'SessionRegistry' type found. 
  I thought that it might be idea issues and tried to run project with this compilation issues but application doesn't start:</p>
  
  <hr>
  
  <p>APPLICATION FAILED TO START</p>
  
  <hr>
  
  <p>Description:</p>
  
  <p>Parameter 0 of constructor in SessionUtils required a bean of type 'org.springframework.security.core.session.SessionRegistry' that could not be found.</p>
  
  <p>Action:</p>
  
  <p>Consider defining a bean of type 'org.springframework.security.core.session.SessionRegistry' in your configuration.</p>
  
  <p>This is example of my class where I try to use SessionRegistry:</p>
  
  <pre><code>    import org.springframework.security.core.session.SessionRegistry;
  
  import org.springframework.security.core.userdetails.User;
  import org.springframework.security.core.userdetails.UserDetails;
  import org.springframework.security.core.session.SessionInformation;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  
  @Component
  public class SessionUtils {
  
      private final SessionRegistry sessionRegistry;
  
      @Autowired
      public SessionUtils(SessionRegistry sessionRegistry) {
          this.sessionRegistry = sessionRegistry;
      }
  
      public void expireUserSessions(String username) {
          for (Object principal : sessionRegistry.getAllPrincipals()) {
              if (principal instanceof User) {
                  UserDetails userDetails = (UserDetails) principal;
                  if (userDetails.getUsername().equals(username)) {
                      for (SessionInformation information : sessionRegistry.getAllSessions(userDetails, true)) {
                          information.expireNow();
                      }
                  }
              }
          }
      }
  }
  </code></pre>
  
  <p>I tried to add @ComponentScan, but it didn't help. 
  My Application.class code: </p>
  
  <pre><code>    import org.springframework.boot.SpringApplication;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.autoconfigure.data.mongo.MongoDataAutoConfiguration;
  import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration;
  import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
  import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration;
  import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
  
  /**
   * Main class for Spring Boot
   */
  @SpringBootApplication(exclude = {MongoAutoConfiguration.class, MongoDataAutoConfiguration.class,
          FreeMarkerAutoConfiguration.class, HttpEncodingAutoConfiguration.class, WebMvcAutoConfiguration.class})
  public class Application {
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>Does anyone have suggestions?</p>