use of org.springframework.context.event.ContextRefreshedEvent in project alfresco-remote-api by Alfresco.
the class ApiBootstrap method onBootstrap.
@Override
protected void onBootstrap(ApplicationEvent event) {
logger.info("Bootstapping the API");
ContextRefreshedEvent refreshEvent = (ContextRefreshedEvent) event;
ApplicationContext ac = refreshEvent.getApplicationContext();
Map<String, Object> entityResourceBeans = ac.getBeansWithAnnotation(EntityResource.class);
Map<String, Object> relationResourceBeans = ac.getBeansWithAnnotation(RelationshipResource.class);
apiDictionary.setDictionary(ResourceDictionaryBuilder.build(entityResourceBeans.values(), relationResourceBeans.values()));
}
use of org.springframework.context.event.ContextRefreshedEvent in project spring-framework by spring-projects.
the class BeanFactoryPostProcessorTests method testBeanFactoryPostProcessorAsApplicationListener.
@Test
public void testBeanFactoryPostProcessorAsApplicationListener() {
StaticApplicationContext ac = new StaticApplicationContext();
ac.registerBeanDefinition("bfpp", new RootBeanDefinition(ListeningBeanFactoryPostProcessor.class));
ac.refresh();
boolean condition = ac.getBean(ListeningBeanFactoryPostProcessor.class).received instanceof ContextRefreshedEvent;
assertThat(condition).isTrue();
}
use of org.springframework.context.event.ContextRefreshedEvent in project spring-boot by spring-projects.
the class SpringApplicationAdminMXBeanRegistrarTests method validateReadyFlag.
@Test
void validateReadyFlag() {
final ObjectName objectName = createObjectName(OBJECT_NAME);
SpringApplication application = new SpringApplication(Config.class);
application.setWebApplicationType(WebApplicationType.NONE);
application.addListeners((ContextRefreshedEvent event) -> {
try {
assertThat(isApplicationReady(objectName)).isFalse();
} catch (Exception ex) {
throw new IllegalStateException("Could not contact spring application admin bean", ex);
}
});
this.context = application.run();
assertThat(isApplicationReady(objectName)).isTrue();
}
Aggregations