title: How do you configure a Session-Scoped bean to be able to access information from the request and from other services?
body: <p>In order for this session-scoped bean to work, it needs access to the <code>Request</code> object to allow it to determine the privileges of the logged-in user.</p>
  
  <p>It also needs to be able to access the <code>userService</code> - another bean.</p>
  
  <p>What does it need in order to gain access to these resources?</p>
  
  <pre><code>@Configuration
  public class ExceptionResolverBuilder 
  {
      @Bean @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)
      public ExceptionResolver getExceptionResolver() 
      {
  
          ExceptionResolver er = new ExceptionResolver();
  
          User user = userService.getLoggedInUser(request);
  
          if(user.isAdmin())
          {
              sendEmail("Caught exception:" + exeption.getMessage());
          }
          else
          {
              writeLog("Caught exception:" + exeption.getMessage());              
          }
  
          return er;
      }
  
  }
  </code></pre>