code: public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
          if( bean instanceof AuthenticationAware || bean instanceof LoginAware ) {
  
              // If the bean isn't a singleton, then add it to our list
              if( beanName == null || !getApplicationContext().containsBean( beanName )
                      || !getApplicationContext().isSingleton( beanName ) ) {
                  addToNonSingletonListeners( bean );
              }
  
              // Install the last known authentication token
              if( bean instanceof AuthenticationAware ) {
                  if( logger.isDebugEnabled() )
                      logger.debug( "NOTIFY bean '" + bean + "' of new authorization for '" + currentAuthentication
                              + "'" );
  
                  AuthenticationAware aab = (AuthenticationAware) bean;
                  aab.setAuthenticationToken(currentAuthentication);
              }
          }
          return bean;
      }
docs: /*
  (non-Javadoc)
  @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object,
  java.lang.String)