Example usage for org.springframework.context ApplicationContextInitializer getClass

List of usage examples for org.springframework.context ApplicationContextInitializer getClass

Introduction

In this page you can find the example usage for org.springframework.context ApplicationContextInitializer getClass.

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:org.wso2.msf4j.spring.MSF4JSpringApplication.java

private void applyInitializers(ConfigurableApplicationContext context) {
    for (ApplicationContextInitializer initializer : getInitializers()) {
        Class<?> requiredType = GenericTypeResolver.resolveTypeArgument(initializer.getClass(),
                ApplicationContextInitializer.class);
        Assert.isInstanceOf(requiredType, context, "Unable to call initializer.");
        initializer.initialize(context);
    }// w  w w .j  a  va 2  s .  c om
}

From source file:org.springframework.boot.SpringApplication.java

/**
 * Apply any {@link ApplicationContextInitializer}s to the context before it is
 * refreshed./*  w ww.  ja  va 2  s  .  co  m*/
 * @param context the configured ApplicationContext (not refreshed yet)
 * @see ConfigurableApplicationContext#refresh()
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void applyInitializers(ConfigurableApplicationContext context) {
    for (ApplicationContextInitializer initializer : getInitializers()) {
        Class<?> requiredType = GenericTypeResolver.resolveTypeArgument(initializer.getClass(),
                ApplicationContextInitializer.class);
        Assert.isInstanceOf(requiredType, context, "Unable to call initializer.");
        initializer.initialize(context);
    }
}