Here are the examples of the java api org.springframework.context.event.ContextRefreshedEvent taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
312 Examples
19
View Source File : VersionRefreshScope.java
License : Apache License 2.0
Project Creator : zouzhirong
License : Apache License 2.0
Project Creator : zouzhirong
public void start(ContextRefreshedEvent event) {
if (event.getApplicationContext() == this.context) {
if (this.eager && this.registry != null) {
for (String name : this.context.getBeanDefinitionNames()) {
BeanDefinition definition = this.registry.getBeanDefinition(name);
if (this.getName().equals(definition.getScope()) && !definition.isLazyInit()) {
this.context.getBean(name);
}
}
}
}
}
19
View Source File : VersionRefreshScope.java
License : Apache License 2.0
Project Creator : zouzhirong
License : Apache License 2.0
Project Creator : zouzhirong
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
start(event);
}
19
View Source File : LicenseCheckListener.java
License : Apache License 2.0
Project Creator : zifangsky
License : Apache License 2.0
Project Creator : zifangsky
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// root application context 没有parent
ApplicationContext context = event.getApplicationContext().getParent();
if (context == null) {
if (StringUtils.isNotBlank(licensePath)) {
logger.info("++++++++ 开始安装证书 ++++++++");
LicenseVerifyParam param = new LicenseVerifyParam();
param.setSubject(subject);
param.setPublicAlias(publicAlias);
param.setStorePreplaced(storePreplaced);
param.setLicensePath(licensePath);
param.setPublicKeysStorePath(publicKeysStorePath);
LicenseVerify licenseVerify = new LicenseVerify();
// 安装证书
licenseVerify.install(param);
logger.info("++++++++ 证书安装结束 ++++++++");
}
}
}
19
View Source File : AbstractScanner.java
License : Apache License 2.0
Project Creator : zhongxunking
License : Apache License 2.0
Project Creator : zhongxunking
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// 扫描
String[] beanNames = event.getApplicationContext().getBeanNamesForAnnotation(annotationType);
for (String beanName : beanNames) {
onScan(event.getApplicationContext().getBean(beanName));
}
}
19
View Source File : FlowerApplicationListener.java
License : Apache License 2.0
Project Creator : zhihuili
License : Apache License 2.0
Project Creator : zhihuili
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
registerFlowerService();
}
19
View Source File : DDDFactory.java
License : Apache License 2.0
Project Creator : zhihuili
License : Apache License 2.0
Project Creator : zhihuili
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (serviceTypes != null) {
for (String serviceType : serviceTypes) {
try {
Clreplaced<?> serviceClreplaced = Clreplaced.forName(serviceType);
String serviceName = FlowerServiceUtil.getServiceName(serviceClreplaced);
FlowerService flowerService = (FlowerService) applicationContext.getBean(serviceClreplaced);
flowerFactory.getServiceFactory().registerFlowerService(serviceName, flowerService);
} catch (ClreplacedNotFoundException e) {
logger.error("", e);
}
}
}
}
19
View Source File : QueueListener.java
License : MIT License
Project Creator : ZeroOrInfinity
License : MIT License
Project Creator : ZeroOrInfinity
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
new Thread(() -> {
String orderNumber;
while (true) {
orderNumber = mockQueue.getCompleteOrder();
if (StringUtils.isNotBlank(orderNumber)) {
log.info("返回订单处理结果:{}", orderNumber);
deferredResultHolder.getMap().get(orderNumber).setResult("place order success " + orderNumber);
mockQueue.setCompleteOrder(null);
} else {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
log.error("线程睡眠出错!", e);
}
}
}
}, "deferredResultThread").start();
}
19
View Source File : ApplicationStartupListener.java
License : Apache License 2.0
Project Creator : zc-zh-001
License : Apache License 2.0
Project Creator : zc-zh-001
/**
* 系统启动 监听事件
*/
@Async
@EventListener
public void handleOrderStateChange(ContextRefreshedEvent contextRefreshedEvent) {
crawlerSet.parallelStream().forEach((service) -> shadowSocksSerivce.crawlerAndSave(service));
log.debug("================>{}", "初始扫描完成...");
}
19
View Source File : CustomSpringListener.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
System.out.println("=======I am a cuctom ContextRefreshedEvent listener,I am listening ContextRefreshedEvent=====");
}
19
View Source File : CustomSpringBootListener2.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
/**
* Handle an application event.
* FileEncodingApplicationListener
* @param event the event to respond to
*/
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
System.out.println("===============用SpringBoot自定义监听器来监听Spring的生命周期事件==================");
}
19
View Source File : ClearCachesApplicationListener.java
License : Apache License 2.0
Project Creator : yuanmabiji
License : Apache License 2.0
Project Creator : yuanmabiji
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
ReflectionUtils.clearCache();
clearClreplacedLoaderCaches(Thread.currentThread().getContextClreplacedLoader());
}
19
View Source File : QueueListener.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent contextRefreshedEvent) {
// 模拟另一个线程从队列里取得DeferredResult后处理响应
new Thread(() -> {
while (true) {
DeferredResult<Object> deferredResult = PulsarHolder.getPulsar().getDeferredResult("84735252737");
if (null != deferredResult) {
// 模拟超时
/*try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}*/
User user = new User();
user.setId(1L);
user.setName("yiz");
deferredResult.setResult(user);
}
try {
// 延时处理
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
19
View Source File : MilkomedaApplicationListener.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
// yml配置的实体需要使用@Lazy!!!
// @Lazy
// @Resource
// private JupiterRuleEngine jupiterRuleEngine;
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
// 设置延迟队列实例名
IceHolder.setInstanceName("product");
// 激活Dead queue里的job(重试超过次数的job)
IceHolder.activeDeadJobs();
// 调用环境变量,给Spring EL表达 #env 提供数据源
ApplicationContextHolder.getEnvironment().put("product", "milkomeda");
// 从json配置加载覆盖yml配置
// String ruleItems = "[{\"match\":\"true\"},{\"domain\":\"t_order\",\"fields\":\"id\",\"filter\":\"user_id={$attr.userInfo.uid}\",\"match\":\"size()==0\",\"syntax\":\"el\"}]";
// jupiterRuleEngine.resetRule("payRule", JSONUtil.parseList(ruleItems, JupiterRuleItem.clreplaced));
}
19
View Source File : MetalContextListener.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
log.info("正加载配置源...");
// 模拟配置源
Map<String, String> source = new HashMap<>();
source.put("env", "dev");
source.put("version", "1.0");
source.put("platform", "mk");
source.put("fee_rate_config", "{\"service\":0.53, \"inst\": 0.3}");
MetalHolder.init(source);
}
19
View Source File : WormholeRegistration.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@EventListener
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
actionMap = AopContextHolder.getHandlerMetaData(WormholeEventHandler.clreplaced, WormholeAction.clreplaced, (annotation, handlerAnnotation, metaData) -> {
WormholeAction wormholeAction = (WormholeAction) annotation;
boolean isAsyncPresentOn = metaData.getMethod().isAnnotationPresent(Async.clreplaced);
Map<String, Object> attrs = new HashMap<>(4);
attrs.put(ATTR_HANG_TYPE, wormholeAction.transactionHang());
attrs.put(ATTR_ASYNC, isAsyncPresentOn);
metaData.setAttributes(attrs);
return wormholeAction.value();
}, false);
// 领域事件跟踪处理器
List<WormholeEventTrack> trackers = AopContextHolder.getTypeHandlers(WormholeEventTracker.clreplaced);
if (!CollectionUtils.isEmpty(trackers)) {
eventBus.setTrackers(trackers);
}
}
19
View Source File : PillarEntryContext.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
pillarEntryMap = AopContextHolder.getHandlerMetaData(PillarEntryHandler.clreplaced, PillarEntryPoint.clreplaced, (annotation, handlerAnnotation, metaData) -> {
PillarEntryHandler pillarEntryHandler = (PillarEntryHandler) handlerAnnotation;
PillarEntryPoint pillarEntryPoint = (PillarEntryPoint) annotation;
String tag = pillarEntryHandler.tag();
if (StringUtils.isEmpty(tag)) {
tag = pillarEntryPoint.tag();
}
// 设置其它属性方法的值
Map<String, Object> attrs = new HashMap<>(2);
attrs.put(ATTR_CODE, pillarEntryPoint.code());
metaData.setAttributes(attrs);
return tag;
}, false);
}
19
View Source File : IceContext.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
topicMap = AopContextHolder.getHandlerMetaData(IceHandler.clreplaced, IceListener.clreplaced, (annotation, handlerAnnotation, metaData) -> {
IceListener iceListener = (IceListener) annotation;
return iceListener.value();
}, !props.isMulreplacedopicListenerPerHandler());
topicTtrMap = AopContextHolder.getHandlerMetaData(IceHandler.clreplaced, IceTtrListener.clreplaced, (annotation, handlerAnnotation, metaData) -> {
IceTtrListener iceTtrListener = (IceTtrListener) annotation;
return iceTtrListener.value();
}, !props.isMulreplacedopicListenerPerHandler());
topicTtrOverloadMap = AopContextHolder.getHandlerMetaData(IceHandler.clreplaced, IceTtrOverloadListener.clreplaced, (annotation, handlerAnnotation, metaData) -> {
IceTtrOverloadListener iceTtrOverloadListener = (IceTtrOverloadListener) annotation;
return iceTtrOverloadListener.value();
}, !props.isMulreplacedopicListenerPerHandler());
}
19
View Source File : HaloContext.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@Override
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
tableNameMap = AopContextHolder.getHandlerMetaData(HaloHandler.clreplaced, HaloListener.clreplaced, (annotation, handlerAnnotation, metaData) -> {
HaloListener haloListener = (HaloListener) annotation;
// 设置其它属性方法的值
Map<String, Object> attrs = new HashMap<>(4);
attrs.put(ATTR_TYPE, haloListener.type());
metaData.setAttributes(attrs);
String value = haloListener.value();
cacheWithType(haloListener.type() == HaloType.PRE ? preTableNameMap : postTableNameMap, value, metaData);
return value;
}, false);
}
19
View Source File : FusionRegistration.java
License : MIT License
Project Creator : yizzuide
License : MIT License
Project Creator : yizzuide
@EventListener
public void onApplicationEvent(@NonNull ContextRefreshedEvent event) {
actionMap = AopContextHolder.getHandlerMetaData(FusionHandler.clreplaced, FusionAction.clreplaced, (annotation, handlerAnnotation, metaData) -> {
FusionAction fusionAction = (FusionAction) annotation;
return fusionAction.value();
}, false);
if (fusionAspect.getConverter() == null) {
fusionAspect.setConverter((tag, returnObj, error) -> {
List<HandlerMetaData> handlerMetaDataList = actionMap.get(tag);
if (CollectionUtils.isEmpty(handlerMetaDataList)) {
return returnObj;
}
HandlerMetaData handlerMetaData = handlerMetaDataList.get(0);
FusionMetaData<?> fusionMetaData = FusionMetaData.builder().returnData(returnObj).error(returnObj == null).msg(error).build();
try {
return handlerMetaData.getMethod().invoke(handlerMetaData.getTarget(), fusionMetaData);
} catch (Exception e) {
log.error("Fusion invoke error with msg: {}", e.getMessage(), e);
}
return returnObj;
});
}
}
19
View Source File : ApplicationStartup.java
License : MIT License
Project Creator : Yirendai
License : MIT License
Project Creator : Yirendai
@Override
public void onApplicationEvent(final ContextRefreshedEvent event) {
start();
}
19
View Source File : RocketMqAutoConfiguration.java
License : Apache License 2.0
Project Creator : yihonglei
License : Apache License 2.0
Project Creator : yihonglei
@Override
public void onApplicationEvent(ContextRefreshedEvent refreshedEvent) {
ApplicationContext context = refreshedEvent.getApplicationContext();
if (context == null || context.getParent() != null) {
return;
}
Map<String, LifeCycle> map = context.getBeansOfType(LifeCycle.clreplaced, false, false);
if (map != null) {
map.forEach((k, v) -> {
v.start();
logger.info("启动成功完成 key:[{}] value:[{}] 启动状态:[{}]", k, v, v.isStart());
});
MAP = map;
}
}
19
View Source File : ApplicationEvent.java
License : Apache License 2.0
Project Creator : xunibidev
License : Apache License 2.0
Project Creator : xunibidev
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
log.info("====应用初始化完成,开启CoinProcessor====");
List<ExchangeCoin> coins = coinService.findAllEnabled();
coins.forEach(coin -> {
CoinProcessor processor = coinProcessorFactory.getProcessor(coin.getSymbol());
processor.initializeThumb();
processor.initializeUsdRate();
processor.setIsHalt(false);
});
}
19
View Source File : ExchangeSpringEvent.java
License : Apache License 2.0
Project Creator : xunibidev
License : Apache License 2.0
Project Creator : xunibidev
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
log.info("======程序启动成功======");
// coinTraderFactory.getTraderMap();
/*
HashMap<String,CoinTrader> traders = coinTraderFactory.getTraderMap();
traders.forEach((symbol,trader) ->{
List<ExchangeOrder> orders = exchangeOrderService.findAllTradingOrderBySymbol(symbol);
List<ExchangeOrder> tradingOrders = new ArrayList<>();
orders.forEach(order -> {
BigDecimal tradedAmount = BigDecimal.ZERO;
BigDecimal turnover = BigDecimal.ZERO;
List<ExchangeOrderDetail> details = exchangeOrderDetailService.findAllByOrderId(order.getOrderId());
order.setDetail(details);
for(ExchangeOrderDetail trade:details){
tradedAmount = tradedAmount.add(trade.getAmount());
turnover = turnover.add(trade.getAmount().multiply(trade.getPrice()));
}
order.setTradedAmount(tradedAmount);
order.setTurnover(turnover);
if(!order.isCompleted()){
tradingOrders.add(order);
}
});
try {
trader.trade(tradingOrders);
} catch (ParseException e) {
e.printStackTrace();
log.info("异常:Exchange Spring Event:trader.trade(tradingOrders);");
}
});
*/
}
19
View Source File : NettyServer.java
License : Apache License 2.0
Project Creator : Xlinlin
License : Apache License 2.0
Project Creator : Xlinlin
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
initNetty();
setHandler();
start();
// 启动后5S开始检查Netty server的状态,每个2两分钟执行一次
scheduledExecutorService.scheduleAtFixedRate(() -> check(), 1, 2, TimeUnit.MINUTES);
}
19
View Source File : DisruptorProducer.java
License : Apache License 2.0
Project Creator : Xlinlin
License : Apache License 2.0
Project Creator : Xlinlin
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
log.info("Start disruptor..........");
doStart();
}
19
View Source File : DisruptorServiceImpl.java
License : Apache License 2.0
Project Creator : Xlinlin
License : Apache License 2.0
Project Creator : Xlinlin
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
initAllCacheService();
}
19
View Source File : DisruptorProducer.java
License : Apache License 2.0
Project Creator : Xlinlin
License : Apache License 2.0
Project Creator : Xlinlin
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
log.info(">>> Disruptor producer 启动......");
doStart();
}
19
View Source File : CanalClientService.java
License : Apache License 2.0
Project Creator : Xlinlin
License : Apache License 2.0
Project Creator : Xlinlin
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
log.info(">>> Creplaced启动......");
init();
// 执行启动
creplacedExecutor.execute(() -> start());
// 启动后5S开始检查connector的状态,每个2两分钟执行一次
scheduledExecutorService.scheduleAtFixedRate(() -> check(), 1, 2, TimeUnit.MINUTES);
}
19
View Source File : PropertyLogger.java
License : GNU General Public License v3.0
Project Creator : wlhbdp
License : GNU General Public License v3.0
Project Creator : wlhbdp
@EventListener
public void handleContextRefresh(ContextRefreshedEvent event) {
logProperties(event.getApplicationContext());
}
19
View Source File : InitializationListener.java
License : Apache License 2.0
Project Creator : wjggwm
License : Apache License 2.0
Project Creator : wjggwm
/* (non-Javadoc)
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (null == event.getApplicationContext().getParent()) {
/**
* 这里可以添加容器启动后需要执行的代码
*/
logger.info("系统初始化完成");
}
}
19
View Source File : AnnotateAnalyzer.java
License : GNU Affero General Public License v3.0
Project Creator : WhiteMagic2014
License : GNU Affero General Public License v3.0
Project Creator : WhiteMagic2014
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext().getParent() == null) {
// @Command 注解 自动注册指令
logger.info("开始扫描注册 command");
Map<String, Object> beans = event.getApplicationContext().getBeansWithAnnotation(com.whitemagic2014.annotate.Command.clreplaced);
for (Object bean : beans.values()) {
if (bean instanceof com.whitemagic2014.command.Command) {
com.whitemagic2014.annotate.Command com = bean.getClreplaced().getAnnotation(com.whitemagic2014.annotate.Command.clreplaced);
if (com.autoLoad()) {
commands.add((com.whitemagic2014.command.Command) bean);
}
}
}
// @Switch 注解自动 注册入MagicSwitch
logger.info("开始注册 component switch");
Map<String, Object> switchBeans = event.getApplicationContext().getBeansWithAnnotation(Switch.clreplaced);
for (Object bean : switchBeans.values()) {
// 只有指令才去登记 非指令不登记
if (bean instanceof Command) {
Switch sw = bean.getClreplaced().getAnnotation(Switch.clreplaced);
MagicSwitch.init(sw.name(), sw.defaultOn());
}
}
}
}
19
View Source File : DailyAction.java
License : MIT License
Project Creator : wangruns
License : MIT License
Project Creator : wangruns
public void onApplicationEvent(ContextRefreshedEvent arg0) {
System.out.println("###-----Spring 容器加载完毕_-_-----###");
init(arg0);
}
19
View Source File : KafkaSampleConsumer.java
License : Apache License 2.0
Project Creator : vmware-archive
License : Apache License 2.0
Project Creator : vmware-archive
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
(new Thread() {
public void run() {
try {
consumeMessages();
} catch (Exception e) {
log.error("Consumer crapped out.", e);
}
}
}).start();
}
19
View Source File : SpringContextInjector.java
License : Apache License 2.0
Project Creator : virjar
License : Apache License 2.0
Project Creator : virjar
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
applicationContext = contextRefreshedEvent.getApplicationContext();
}
19
View Source File : ResourceUrlProvider.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (isAutodetect()) {
this.handlerMap.clear();
detectResourceHandlers(event.getApplicationContext());
if (!this.handlerMap.isEmpty()) {
this.autodetect = false;
}
}
}
19
View Source File : ResourceUrlProvider.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (this.handlerMap.isEmpty()) {
detectResourceHandlers(event.getApplicationContext());
}
}
19
View Source File : JmsListenerEndpointRegistry.java
License : MIT License
Project Creator : Vip-Augus
License : MIT License
Project Creator : Vip-Augus
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (event.getApplicationContext() == this.applicationContext) {
this.contextRefreshed = true;
}
}
19
View Source File : QueueListener.java
License : Apache License 2.0
Project Creator : ukihsoroy
License : Apache License 2.0
Project Creator : ukihsoroy
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
new Thread(() -> {
while (true) {
if (StringUtils.isNotBlank(mockQueue.getCompleteOrder())) {
String orderNumber = mockQueue.getCompleteOrder();
_LOGGER.info("返回订单处理结果: {}", orderNumber);
deferredResultHolder.getMap().get(orderNumber).setResult("place order success;");
mockQueue.setCompleteOrder(null);
} else {
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}).start();
}
19
View Source File : ServiceConfigBean.java
License : Apache License 2.0
Project Creator : TFdream
License : Apache License 2.0
Project Creator : TFdream
@Override
public void onApplicationEvent(ContextRefreshedEvent contextRefreshedEvent) {
if (!isExported()) {
export();
}
}
19
View Source File : PermissionHandleListener.java
License : MIT License
Project Creator : TaleLin
License : MIT License
Project Creator : TaleLin
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
addNewPermissions();
removeUnusedPermissions();
}
19
View Source File : EmbeddedModuleStartupListener.java
License : MIT License
Project Creator : sunshower-io
License : MIT License
Project Creator : sunshower-io
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
val module = (EmbeddedModule) event.getApplicationContext().getBean(Module.clreplaced);
val kernel = event.getApplicationContext().getBean(Kernel.clreplaced);
}
19
View Source File : MykitTransactionEventPublisher.java
License : Apache License 2.0
Project Creator : sunshinelyz
License : Apache License 2.0
Project Creator : sunshinelyz
@Override
public void onApplicationEvent(final ContextRefreshedEvent contextRefreshedEvent) {
start(mykitTransactionMessageConfig.getBufferSize(), mykitTransactionMessageConfig.getConsumerThreads());
}
19
View Source File : ApplicationStartListener.java
License : GNU Lesser General Public License v3.0
Project Creator : sunpengChina
License : GNU Lesser General Public License v3.0
Project Creator : sunpengChina
public void onApplicationEvent(ContextRefreshedEvent event) {
if (!firstEvent) {
return;
} else {
firstEvent = false;
IServer center = event.getApplicationContext().getBean(IServer.clreplaced);
try {
center.connect();
} catch (ConnectException | NonexistException | InterruptedException e) {
logger.error(e);
}
}
}
19
View Source File : DestroyGemFireMockObjectsApplicationListenerUnitTests.java
License : Apache License 2.0
Project Creator : spring-projects
License : Apache License 2.0
Project Creator : spring-projects
@Test
public void doesNotDestroyGemFireMockObjectsOnContextRefreshedEvent() {
ContextRefreshedEvent mockEvent = mock(ContextRefreshedEvent.clreplaced);
this.listener.onApplicationEvent(mockEvent);
verify(this.listener, never()).destroyGemFireMockObjects();
}
19
View Source File : SecurityManagerProxyConfiguration.java
License : Apache License 2.0
Project Creator : spring-projects
License : Apache License 2.0
Project Creator : spring-projects
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
SecurityManagerProxy securityManagerProxy = SecurityManagerProxy.getInstance();
securityManagerProxy.setBeanFactory(event.getApplicationContext().getAutowireCapableBeanFactory());
securityManagerProxy.init(new Properties());
}
19
View Source File : CRefreshEventHandler.java
License : Apache License 2.0
Project Creator : SourceHot
License : Apache License 2.0
Project Creator : SourceHot
public void onApplicationEvent(ContextRefreshedEvent event) {
System.out.println("ContextRefreshedEvent Received");
}
19
View Source File : AsyncTaskExecutionListener.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (applicationContext.equals(event.getApplicationContext())) {
AsyncTaskExecutor.ensureAsyncTasksFinish();
}
}
19
View Source File : ApplicationContextRefreshedListener.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
ApplicationContext applicationContext = event.getApplicationContext();
// rpc 开始启动事件监听器
applicationContext.publishEvent(new SofaBootRpcStartEvent(applicationContext));
// rpc 启动完毕事件监听器
applicationContext.publishEvent(new SofaBootRpcStartAfterEvent(applicationContext));
}
19
View Source File : SofaModuleContextRefreshedListener.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (applicationContext.equals(event.getApplicationContext())) {
try {
pipelineContext.process();
} catch (Throwable t) {
SofaLogger.error("process pipeline error", t);
throw new RuntimeException(t);
}
}
}
19
View Source File : ReadinessCheckListener.java
License : Apache License 2.0
Project Creator : sofastack
License : Apache License 2.0
Project Creator : sofastack
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (applicationContext.equals(event.getApplicationContext())) {
healthCheckerProcessor.init();
healthIndicatorProcessor.init();
afterReadinessCheckCallbackProcessor.init();
readinessHealthCheck();
readinessCheckFinish = true;
}
}
See More Examples