Java 类org.springframework.web.context.support.SpringBeanAutowiringSupport 实例源码

项目:cas-5.1.0    文件:MultifactorAuthenticationTrustStorageCleaner.java   
/**
 * Clean up expired records.
 */
@Scheduled(initialDelayString = "${cas.authn.mfa.trusted.cleaner.startDelay:PT10S}",
           fixedDelayString = "${cas.authn.mfa.trusted.cleaner.repeatInterval:PT60S}")
public void clean() {

    if (!trustedProperties.getCleaner().isEnabled()) {
        LOGGER.debug("[{}] is disabled. Expired trusted authentication records will not automatically be cleaned up by CAS",
                getClass().getName());
        return;
    }

    try {
        LOGGER.debug("Proceeding to clean up expired trusted authentication records...");

        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
        final LocalDate validDate = LocalDate.now().minus(trustedProperties.getExpiration(),
                DateTimeUtils.toChronoUnit(trustedProperties.getTimeUnit()));
        LOGGER.info("Expiring records that are on/before [{}]", validDate);
        this.storage.expire(validDate);
    } catch (final Exception e) {
        LOGGER.error(e.getMessage(), e);
    }
}
项目:cf-mta-deploy-service    文件:BootstrapServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
        SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
        configuration.load();
        initializeProviders();
        initializeActiviti();
        addDeployTargets();
        initExtras();
        configuration.logFullConfig();
        processEngine.getProcessEngineConfiguration().getJobExecutor().start();
        LOGGER.info(Messages.ALM_SERVICE_ENV_INITIALIZED);
    } catch (Exception e) {
        LOGGER.error("Initialization error", e);
        throw new ServletException(e);
    }
}
项目:cosmic    文件:CloudStartupServlet.java   
@Override
public void init(final ServletConfig config) throws ServletException {
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());

    // wait when condition is ready for initialization
    _timer.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            if (ComponentContext.getApplicationContext() != null) {
                _timer.cancel();

                final TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
                try {
                    ComponentContext.initComponentsLifeCycle();
                } finally {
                    txn.close();
                }
            }
        }
    }, 0, 1000);
}
项目:gocd    文件:BackupFilter.java   
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    if (backupService == null) {
        SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    }

    String url = ((HttpServletRequest) request).getRequestURI();
    if (isBackupFinishJsonUrl(url)) {
        ((HttpServletResponse) response).setHeader("Cache-Control", "private, max-age=0, no-cache");
        ((HttpServletResponse) response).setDateHeader("Expires", 0);
        generateResponseForIsBackupFinishedAPI(response);
        return;
    }
    if (backupService.isBackingUp()) {
        ((HttpServletResponse) response).setHeader("Cache-Control", "private, max-age=0, no-cache");
        ((HttpServletResponse) response).setDateHeader("Expires", 0);
        if (isAPIUrl(url) && !isMessagesJson(url)) {
            generateAPIResponse(request, response);
        } else {
            generateHTMLResponse(response);
        }
    } else {
        chain.doFilter(request, response);
    }

}
项目:cloudstack    文件:CloudStartupServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
    LogUtils.initLog4j("log4j-cloud.xml");
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());

    // wait when condition is ready for initialization
    _timer.scheduleAtFixedRate(new TimerTask() {
        @Override
        public void run() {
            if (ComponentContext.getApplicationContext() != null) {
                _timer.cancel();

                TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
                try {
                    ComponentContext.initComponentsLifeCycle();
                } finally {
                    txn.close();
                }
            }
        }
    }, 0, 1000);
}
项目:springboot-shiro-cas-mybatis    文件:AbstractInMemoryThrottledSubmissionHandlerInterceptorAdapter.java   
@Override
public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    try {
        logger.info("Beginning audit cleanup...");
        decrementCounts();
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    }
}
项目:cas-5.1.0    文件:BaseOneTimeTokenRepository.java   
@Override
public final void clean() {
    LOGGER.debug("Starting to clean expiring and previously used google authenticator tokens");
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    cleanInternal();
    LOGGER.info("Finished cleaning google authenticator tokens");
}
项目:cas-server-4.2.1    文件:AbstractInMemoryThrottledSubmissionHandlerInterceptorAdapter.java   
@Override
public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    try {
        logger.info("Beginning audit cleanup...");
        decrementCounts();
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    }
}
项目:cas-server-4.2.1    文件:DefaultTicketRegistry.java   
@Override
public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

    try {
        logger.info("Beginning ticket cleanup...");
        final Collection<Ticket> ticketsToRemove = Collections2.filter(this.getTickets(), new Predicate<Ticket>() {
            @Override
            public boolean apply(@Nullable final Ticket ticket) {
                if (ticket.isExpired()) {
                    if (ticket instanceof TicketGrantingTicket) {
                        logger.debug("Cleaning up expired ticket-granting ticket [{}]", ticket.getId());
                        logoutManager.performLogout((TicketGrantingTicket) ticket);
                        deleteTicket(ticket.getId());
                    } else if (ticket instanceof ServiceTicket) {
                        logger.debug("Cleaning up expired service ticket [{}]", ticket.getId());
                        deleteTicket(ticket.getId());
                    } else {
                        logger.warn("Unknown ticket type [{} found to clean", ticket.getClass().getSimpleName());
                    }
                    return true;
                }
                return false;
            }
        });
        logger.info("{} expired tickets found and removed.", ticketsToRemove.size());
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    }
}
项目:java-samples    文件:HelloServlet.java   
/**
 * Cette méthode init pourrait être déplacée dans une classe abstraite
 *
 * @see javax.servlet.GenericServlet#init()
 */
@Override
public void init() throws ServletException {
    super.init();
    // déclenchement de l'autowiring de la classe
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    // on ne peut pas faire d'autowire par constructeur dans ce cas là
}
项目:shogun2    文件:PersistentObjectIdResolver.java   
/**
 * Default Constructor that injects beans automatically.
 *
 * @param entityClass
 */
protected PersistentObjectIdResolver() {
    // As subclasses of this class are used in the resolver property of an
    // JsonIdentityInfo annotation, we cannot easily autowire components
    // (like the service for the current). For that reason, we use this
    // helper method to process the injection of the services
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:otus_java_2017_06    文件:TimerServlet.java   
private void initAutowiredBeans() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:otus_java_2017_06    文件:TimerServlet.java   
private void initAutowiredBeans() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:taskana    文件:DistributionTargetDeserializer.java   
public DistributionTargetDeserializer() {
    this(null);
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:jwx    文件:WeixinDispatcherServlet.java   
/**
 * 解析微信类
 * 
 * @param clazz
 * @throws ServletException
 * @throws MultiWeixinEncodingAESKeyException
 * @throws IllegalAccessException
 * @throws InstantiationException
 */
private void parseWeixinClass(Class<?> clazz) throws ServletException {
    Weixin wx = clazz.getAnnotation(Weixin.class);
    String url = wx.value();
    // 获取url对应的微信上下文,如果不存在,就新建一个
    WeixinContext context = contextMapper.get(url);
    if (context == null) {
        context = new WeixinContext();
        logger.debug("新建微信上下文(" + url + ")");
        contextMapper.put(url, context);
    }

    // 获取微信上下文的url,如果为空,则赋值
    if (StringUtil.isNull(context.getUrl())) {
        context.setUrl(url);
    }

    WeixinSetting setting = new WeixinSetting();
    setting.setUrl(url);
    setting.setAppID(wx.appID());
    setting.setAppSecret(wx.appSecret());
    setting.setEncodingAESKey(wx.encodingAESKey());
    setting.setToken(wx.token());

    //配置微信参数
    setContextParameter(context, setting);

    Object wxObj;
    try {
        // 生成微信对象实例
        wxObj = clazz.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        throw new InitialWeixinConfigureException("实例化微信对象异常", e);
    }

    // 注入spring服务
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(wxObj, getServletContext());

    Method[] methods = clazz.getDeclaredMethods();
    // 解析微信方法
    for (Method method : methods) {
        if (WeixinMethod.hasWeixinAnnotationType(method)) {
            logger.debug("解析微信上下文(" + url + ")微信方法:" + method.getName());
            parseWeixinMethod(context, method, wxObj);
        }
    }
}
项目:cas-server-4.2.1    文件:JpaTicketRegistry.java   
@Override
public void execute(final JobExecutionContext jobExecutionContext) throws JobExecutionException {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);

    try {

        logger.info("Beginning ticket cleanup.");
        logger.debug("Attempting to acquire ticket cleanup lock.");
        if (!this.jpaLockingStrategy.acquire()) {
            logger.info("Could not obtain lock.  Aborting cleanup.");
            return;
        }
        logger.debug("Acquired lock.  Proceeding with cleanup.");

        logger.info("Beginning ticket cleanup...");
        final Collection<Ticket> ticketsToRemove = Collections2.filter(this.getTickets(), new Predicate<Ticket>() {
            @Override
            public boolean apply(final Ticket ticket) {
                if (ticket.isExpired()) {
                    if (ticket instanceof TicketGrantingTicket) {
                        logger.debug("Cleaning up expired ticket-granting ticket [{}]", ticket.getId());
                        logoutManager.performLogout((TicketGrantingTicket) ticket);
                        deleteTicket(ticket.getId());
                    } else if (ticket instanceof ServiceTicket) {
                        logger.debug("Cleaning up expired service ticket [{}]", ticket.getId());
                        deleteTicket(ticket.getId());
                    } else {
                        logger.warn("Unknown ticket type [{} found to clean", ticket.getClass().getSimpleName());
                    }
                    return true;
                }
                return false;
            }
        });
        logger.info("{} expired tickets found and removed.", ticketsToRemove.size());
    } catch (final Exception e) {
        logger.error(e.getMessage(), e);
    } finally {
        logger.debug("Releasing ticket cleanup lock.");
        this.jpaLockingStrategy.release();
        logger.info("Finished ticket cleanup.");
    }

}
项目:lams    文件:ResendMessagesJob.java   
public ResendMessagesJob() {
//First recover context of the job since it is created by Quartz, not Spring
SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
   }
项目:unitimes    文件:CalendarServlet.java   
@Override
public void init() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:otus_java_2017_04    文件:TimerServlet.java   
private void initAutowiredBeans() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:membrane-spring-boot-starter    文件:MembraneServlet.java   
@Override
public void init() throws ServletException {
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, this.getServletContext());
}
项目:cosmic    文件:ConsoleProxyServlet.java   
@Override
public void init(final ServletConfig config) throws ServletException {
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
    s_keysMgr = _keysMgr;
}
项目:cosmic    文件:ApiServlet.java   
@Override
public void init(final ServletConfig config) throws ServletException {
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
}
项目:wte4j    文件:GwtOrderServiceServlet.java   
public void init() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:wte4j    文件:TemplateServiceGWTAdapter.java   
public void init() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:sandbox-frame    文件:ProjectFileServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
      config.getServletContext());
}
项目:superfly    文件:AutowiringServlet.java   
@Override
public final void init(ServletConfig config) throws ServletException {
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, config.getServletContext());
    doInit(config);
}
项目:momo3-backend    文件:MomoLayerSerializer.java   
public MomoLayerSerializer(Class<MomoLayer> t) {
    super(t);
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:momo3-backend    文件:MomoUserSerializer.java   
public MomoUserSerializer(Class<MomoUser> t) {
    super(t);
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:unitime    文件:CalendarServlet.java   
@Override
public void init() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:authlib-agent    文件:YggdrasilServlet.java   
@Override
public void init() throws ServletException {
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this, getServletContext());
}
项目:softwarecave    文件:PeriodicTableAdminWS.java   
@PostConstruct
protected void init() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
}
项目:softwarecave    文件:PeriodicTableAccessWS.java   
@PostConstruct
protected void init() {
    SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
    logger.info("Injected " + periodicTableService);
}
项目:avro-ui    文件:FileUploadServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
      config.getServletContext());
}
项目:kaa    文件:ProfileDownloadServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport
      .processInjectionBasedOnServletContext(this, config.getServletContext());
}
项目:kaa    文件:UserConfServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport
      .processInjectionBasedOnServletContext(this, config.getServletContext());
}
项目:kaa    文件:ConfigurationDownloadServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport
      .processInjectionBasedOnServletContext(this, config.getServletContext());
}
项目:kaa    文件:CtlExportServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport
      .processInjectionBasedOnServletContext(this, config.getServletContext());
}
项目:kaa    文件:RecordServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport
      .processInjectionBasedOnServletContext(this, config.getServletContext());
}
项目:kaa    文件:SdkServlet.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
      config.getServletContext());
}
项目:kaa    文件:FileUpload.java   
@Override
public void init(ServletConfig config) throws ServletException {
  super.init(config);
  SpringBeanAutowiringSupport.processInjectionBasedOnServletContext(this,
      config.getServletContext());
}