Java Code Examples for org.springframework.boot.SpringApplication#setWebEnvironment()
The following examples show how to use
org.springframework.boot.SpringApplication#setWebEnvironment() .
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: ContainerApplication.java From tac with MIT License | 6 votes |
public static void main(String[] args) throws Exception { // the code must execute before spring start JarFile bootJarFile = BootJarLaucherUtils.getBootJarFile(); if (bootJarFile != null) { BootJarLaucherUtils.unpackBootLibs(bootJarFile); log.debug("the temp tac lib folder:{}", BootJarLaucherUtils.getTempUnpackFolder()); } SpringApplication springApplication = new SpringApplication(ContainerApplication.class); springApplication.setWebEnvironment(true); springApplication.setBannerMode(Banner.Mode.OFF); springApplication.addListeners(new ApplicationListener<ApplicationEnvironmentPreparedEvent>() { @Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { CodeLoadService.changeClassLoader(event.getEnvironment()); } }); springApplication.run(args); }
Example 2
Source File: HostInfoDiscoveryPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 6 votes |
@Test public void testAllSet() { SpringApplication app = new SpringApplication(TestConfiguration.class); app.setWebEnvironment(false); ConfigurableApplicationContext context = app .run(new String[] { "--spring.net.hostdiscovery.pointToPoint=true", "--spring.net.hostdiscovery.loopback=true", "--spring.net.hostdiscovery.preferInterface=lxcbr", "--spring.net.hostdiscovery.matchIpv4=192.168.0.0/24", "--spring.net.hostdiscovery.matchInterface=eth0" }); HostInfoDiscoveryProperties properties = context.getBean(HostInfoDiscoveryProperties.class); assertThat(properties, notNullValue()); assertThat(properties.isPointToPoint(), is(true)); assertThat(properties.isLoopback(), is(true)); assertThat(properties.getPreferInterface(), notNullValue()); assertThat(properties.getPreferInterface().size(), is(1)); assertThat(properties.getMatchIpv4(), is("192.168.0.0/24")); assertThat(properties.getMatchInterface(), is("eth0")); context.close(); }
Example 3
Source File: GpfdistSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 6 votes |
@Test public void testErrorTable1() { SpringApplication app = new SpringApplication(TestConfiguration.class); app.setWebEnvironment(false); ConfigurableApplicationContext context = app .run(new String[] { "--gpfdist.errorTable=myerror", "--gpfdist.segmentRejectLimit=1", "--gpfdist.segmentRejectType=ROWS" }); GpfdistSinkProperties properties = context.getBean(GpfdistSinkProperties.class); assertThat(properties, notNullValue()); assertThat(properties.getErrorTable(), is("myerror")); assertThat(properties.getSegmentRejectLimit(), is("1")); assertThat(properties.getSegmentRejectType(), is(SegmentRejectType.ROWS)); context.close(); }
Example 4
Source File: GpfdistSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 6 votes |
@Test public void testErrorTable2() { SpringApplication app = new SpringApplication(TestConfiguration.class); app.setWebEnvironment(false); ConfigurableApplicationContext context = app .run(new String[] { "--gpfdist.errorTable=myerror", "--gpfdist.segmentRejectLimit=1", "--gpfdist.segmentRejectType=percent" }); GpfdistSinkProperties properties = context.getBean(GpfdistSinkProperties.class); assertThat(properties, notNullValue()); assertThat(properties.getErrorTable(), is("myerror")); assertThat(properties.getSegmentRejectLimit(), is("1")); assertThat(properties.getSegmentRejectType(), is(SegmentRejectType.PERCENT)); context.close(); }
Example 5
Source File: Osiam.java From osiam with MIT License | 6 votes |
public static void main(String[] args) { SpringApplication application = new SpringApplication(); String command = new CliCommand(args).get(); OsiamHome osiamHome = new OsiamHome(); if ("initHome".equals(command)) { application.setSources(Collections.<Object>singleton(InitHome.class)); application.setWebEnvironment(false); } else if ("migrateDb".equals(command)) { application.setSources(Collections.<Object>singleton(MigrateDb.class)); application.setWebEnvironment(false); osiamHome.shouldInitializeHome(false); } else { application.setSources(Collections.<Object>singleton(Osiam.class)); } application.addListeners(osiamHome); application.setDefaultProperties(DEFAULT_PROPERTIES); application.run(args); }
Example 6
Source File: App.java From mojito with Apache License 2.0 | 5 votes |
/** * Application entry point. * * @param args */ public static void main(String[] args) { SpringApplication app = new SpringApplication(App.class); app.setBannerMode(Banner.Mode.OFF); app.setWebEnvironment(false); app.run(args); }
Example 7
Source File: HostInfoDiscoveryPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void testPreferOne() { SpringApplication app = new SpringApplication(TestConfiguration.class); app.setWebEnvironment(false); ConfigurableApplicationContext context = app .run(new String[] { "--spring.net.hostdiscovery.preferInterface=lxcbr" }); HostInfoDiscoveryProperties properties = context.getBean(HostInfoDiscoveryProperties.class); assertThat(properties, notNullValue()); assertThat(properties.getPreferInterface(), notNullValue()); assertThat(properties.getPreferInterface().size(), is(1)); context.close(); }
Example 8
Source File: HostInfoDiscoveryPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void testPreferTwo() { SpringApplication app = new SpringApplication(TestConfiguration.class); app.setWebEnvironment(false); ConfigurableApplicationContext context = app .run(new String[] { "--spring.net.hostdiscovery.preferInterface=lxcbr,foo" }); HostInfoDiscoveryProperties properties = context.getBean(HostInfoDiscoveryProperties.class); assertThat(properties, notNullValue()); assertThat(properties.getPreferInterface(), notNullValue()); assertThat(properties.getPreferInterface().size(), is(2)); assertThat(properties.getPreferInterface(), containsInAnyOrder("lxcbr", "foo")); context.close(); }
Example 9
Source File: GpfdistSinkPropertiesTests.java From spring-cloud-stream-app-starters with Apache License 2.0 | 5 votes |
@Test public void testNullString() { SpringApplication app = new SpringApplication(TestConfiguration.class); app.setWebEnvironment(false); ConfigurableApplicationContext context = app .run(new String[] { "--gpfdist.nullString=mynullstring" }); GpfdistSinkProperties properties = context.getBean(GpfdistSinkProperties.class); assertThat(properties, notNullValue()); assertThat(properties.getNullString(), is("mynullstring")); context.close(); }
Example 10
Source File: UserRegistrationSteps.java From user-registration-V2 with Apache License 2.0 | 5 votes |
public UserRegistrationSteps() { super(); SpringApplication application = new SpringApplication( RegistrationApplication.class); application.setWebEnvironment(false); AutowiredAnnotationBeanPostProcessor autowiredAnnotationBeanPostProcessor = new AutowiredAnnotationBeanPostProcessor(); autowiredAnnotationBeanPostProcessor.setBeanFactory(application.run() .getBeanFactory()); autowiredAnnotationBeanPostProcessor.processInjection(this); }
Example 11
Source File: UserRegistrationSteps.java From user-registration-V2 with Apache License 2.0 | 5 votes |
public UserRegistrationSteps() { super(); SpringApplication application = new SpringApplication( RegistrationApplication.class); application.setWebEnvironment(false); AutowiredAnnotationBeanPostProcessor autowiredAnnotationBeanPostProcessor = new AutowiredAnnotationBeanPostProcessor(); autowiredAnnotationBeanPostProcessor.setBeanFactory(application.run() .getBeanFactory()); autowiredAnnotationBeanPostProcessor.processInjection(this); }
Example 12
Source File: MonitoringApplication.java From Ratel with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws Exception { SpringApplication app = new SpringApplication(MonitoringApplication.class); app.setWebEnvironment(false); ConfigurableApplicationContext ctx = app.run(args); MonitoringApplication myApp = ctx.getBean(MonitoringApplication.class); myApp.testMonitoring(); ctx.close(); }
Example 13
Source File: MyApplication.java From Ratel with Apache License 2.0 | 5 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(MyApplication.class); app.setWebEnvironment(false); ConfigurableApplicationContext ctx = app.run(args); MyApplication myApp = ctx.getBean(MyApplication.class); myApp.playConsoleGame(); ctx.close(); }
Example 14
Source File: Starter.java From new-bull with MIT License | 4 votes |
public static void main(String[] args) { SpringApplication application = new SpringApplication(Starter.class); // To disabled web environment, change `true` to `false` application.setWebEnvironment(true); application.run(args); }
Example 15
Source File: TalkGrpcApplication.java From sctalk with Apache License 2.0 | 4 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(TalkGrpcApplication.class); app.setWebEnvironment(false); app.run(args); }
Example 16
Source File: OperationsLoggingApplication.java From building-microservices with Apache License 2.0 | 4 votes |
public static void main(String[] args) { SpringApplication application = new SpringApplication( OperationsLoggingApplication.class); application.setWebEnvironment(false); application.run(args); }