Java Code Examples for org.springframework.boot.SpringApplication#addInitializers()
The following examples show how to use
org.springframework.boot.SpringApplication#addInitializers() .
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: JafuApplication.java From spring-fu with Apache License 2.0 | 6 votes |
/** * Run the current application * @param profiles {@link ApplicationContext} profiles separated by commas. * @param args the application arguments (usually passed from a Java main method) * @return The application context of the application * @see #run() * @see #run(String[]) * @see #run(String) */ public ConfigurableApplicationContext run(String profiles, String[] args) { SpringApplication app = new SpringApplication(JafuApplication.class) { @Override protected void load(ApplicationContext context, Object[] sources) { // We don't want the annotation bean definition reader } @Override protected ConfigurableApplicationContext createApplicationContext() { return createContext(); } }; if (!profiles.isEmpty()) { app.setAdditionalProfiles(Arrays.stream(profiles.split(",")).map(it -> it.trim()).toArray(String[]::new)); } app.addInitializers(this.initializer); if (this.customizer != null) app.addInitializers(this.customizer); System.setProperty("spring.backgroundpreinitializer.ignore", "true"); // TODO Manage lazy loading like in Kofu return app.run(args); }
Example 2
Source File: BootstrapApplicationListener.java From spring-cloud-commons with Apache License 2.0 | 6 votes |
private void addAncestorInitializer(SpringApplication application, ConfigurableApplicationContext context) { boolean installed = false; for (ApplicationContextInitializer<?> initializer : application .getInitializers()) { if (initializer instanceof AncestorInitializer) { installed = true; // New parent ((AncestorInitializer) initializer).setParent(context); } } if (!installed) { application.addInitializers(new AncestorInitializer(context)); } }
Example 3
Source File: GatewayApplication.java From api-layer with Eclipse Public License 2.0 | 5 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(GatewayApplication.class); app.addInitializers(new LatencyUtilsConfigInitializer()); app.setLogStartupInfo(false); new BuildInfo().logBuildInfo(); app.run(args); }
Example 4
Source File: DiscoveryServiceApplication.java From api-layer with Eclipse Public License 2.0 | 5 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(DiscoveryServiceApplication.class); app.addInitializers(new LatencyUtilsConfigInitializer()); app.setLogStartupInfo(false); new BuildInfo().logBuildInfo(); app.run(args); }
Example 5
Source File: DiscoverableClientSampleApplication.java From api-layer with Eclipse Public License 2.0 | 5 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(DiscoverableClientSampleApplication.class); app.addInitializers(new LatencyUtilsConfigInitializer()); app.setLogStartupInfo(false); new BuildInfo().logBuildInfo(); app.run(args); }
Example 6
Source File: ApiCatalogApplication.java From api-layer with Eclipse Public License 2.0 | 5 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(ApiCatalogApplication.class); app.addInitializers(new LatencyUtilsConfigInitializer()); app.setLogStartupInfo(false); new BuildInfo().logBuildInfo(); app.run(args); }
Example 7
Source File: NacosConfigEnvironmentProcessor.java From nacos-spring-boot-project with Apache License 2.0 | 5 votes |
@Override public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { application.addInitializers(new NacosConfigApplicationContextInitializer(this)); nacosConfigProperties = NacosConfigPropertiesUtils .buildNacosConfigProperties(environment); if (enable()) { System.out.println( "[Nacos Config Boot] : The preload log configuration is enabled"); loadConfig(environment); } }
Example 8
Source File: FountainMain.java From fountain with Apache License 2.0 | 5 votes |
public static void main(String[] args) { SpringApplication springApplication = new SpringApplication(FountainMain.class); springApplication.setBanner(new FountainBanner()); String consumeActorXmlPath = SysPropUtil.getSystemProperty("consume.actor.xml.classpath"); if (StringUtils.isNotEmpty(consumeActorXmlPath)) { springApplication.addInitializers(new FountainConsumerApplicationContextInitializer(consumeActorXmlPath)); } springApplication.run(args); }
Example 9
Source File: AbstractSpringFunctionAdapterInitializer.java From spring-cloud-function with Apache License 2.0 | 5 votes |
private void registerTargetContext(C targetContext, SpringApplication builder) { if (targetContext != null) { builder.addInitializers(new ApplicationContextInitializer<ConfigurableApplicationContext>() { @SuppressWarnings("unchecked") @Override public void initialize(ConfigurableApplicationContext applicationContext) { ((GenericApplicationContext) applicationContext).registerBean(TARGET_EXECUTION_CTX_BEAN_NAME, (Class<C>) targetContext.getClass(), (Supplier<C>) () -> targetContext); } }); } }
Example 10
Source File: PlumemoApplication.java From plumemo with Apache License 2.0 | 4 votes |
public static void main(String[] args) { SpringApplication springApplication = new SpringApplication(PlumemoApplication.class); springApplication.addInitializers(new ConfigApplicationContextInitializer()); springApplication.run(args); }
Example 11
Source File: Application.java From fredbet with Creative Commons Attribution Share Alike 4.0 International | 4 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(Application.class); app.addInitializers(new AppInitializer()); app.run(args); }
Example 12
Source File: SpringOidcDiscoveryApplication.java From tutorials with MIT License | 4 votes |
public static void main(String[] args) { SpringApplication application = new SpringApplication(SpringOidcDiscoveryApplication.class); ApplicationContextInitializer<ConfigurableApplicationContext> yamlInitializer = new YamlLoaderInitializer("discovery-application.yml"); application.addInitializers(yamlInitializer); application.run(args); }
Example 13
Source File: SpringOidcLoginApplication.java From tutorials with MIT License | 4 votes |
public static void main(String[] args) { SpringApplication application = new SpringApplication(SpringOidcLoginApplication.class); ApplicationContextInitializer<ConfigurableApplicationContext> yamlInitializer = new YamlLoaderInitializer("login-application.yml"); application.addInitializers(yamlInitializer); application.run(args); }
Example 14
Source File: SpringOidcSessionManagementApplication.java From tutorials with MIT License | 4 votes |
public static void main(String[] args) { SpringApplication application = new SpringApplication(SpringOidcSessionManagementApplication.class); ApplicationContextInitializer<ConfigurableApplicationContext> yamlInitializer = new YamlLoaderInitializer("sessionmanagement-application.yml"); application.addInitializers(yamlInitializer); application.run(args); }