org.springframework.context.annotation.AnnotationConfigRegistry Java Examples

The following examples show how to use org.springframework.context.annotation.AnnotationConfigRegistry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ContextHelper.java    From graphql-java-datetime with Apache License 2.0 6 votes vote down vote up
static public AbstractApplicationContext load() {
    AbstractApplicationContext context;

    try {
        context = AnnotationConfigApplicationContext.class.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }

    AnnotationConfigRegistry registry = (AnnotationConfigRegistry) context;

    registry.register(BaseConfiguration.class);
    registry.register(GraphQLJavaToolsAutoConfiguration.class);

    context.refresh();

    return context;
}
 
Example #2
Source File: TestRefreshableApplicationContextLoader.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
private ConfigurableApplicationContext configureComponentClasses(
		ConfigurableApplicationContext applicationContext, MergedContextConfiguration contextConfiguration) {

	Optional.ofNullable(applicationContext)
		.filter(it -> ArrayUtils.isNotEmpty(contextConfiguration.getClasses()))
		.filter(AnnotationConfigRegistry.class::isInstance)
		.map(AnnotationConfigRegistry.class::cast)
		.ifPresent(registry -> registry.register(contextConfiguration.getClasses()));

	return applicationContext;
}
 
Example #3
Source File: TestRefreshableApplicationContextLoader.java    From spring-boot-data-geode with Apache License 2.0 5 votes vote down vote up
private ConfigurableApplicationContext configureScan(ConfigurableApplicationContext applicationContext,
		MergedContextConfiguration contextConfiguration) {

	Optional.ofNullable(applicationContext)
		.filter(it -> ArrayUtils.isNotEmpty(contextConfiguration.getLocations()))
		.filter(AnnotationConfigRegistry.class::isInstance)
		.map(AnnotationConfigRegistry.class::cast)
		.ifPresent(registry -> registry.scan(contextConfiguration.getLocations()));

	return applicationContext;
}