org.springframework.boot.Banner Java Examples
The following examples show how to use
org.springframework.boot.Banner.
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: AbstractJasyptMojo.java From jasypt-spring-boot with MIT License | 6 votes |
@Override public void execute() throws MojoExecutionException { Map<String, Object> defaultProperties = new HashMap<>(); defaultProperties.put("spring.config.location", "file:./src/main/resources/"); ConfigurableApplicationContext context = new SpringApplicationBuilder() .sources(Application.class) .bannerMode(Banner.Mode.OFF) .properties(defaultProperties) .run(); this.environment = context.getEnvironment(); String[] activeProfiles = context.getEnvironment().getActiveProfiles(); String profiles = activeProfiles.length != 0 ? String.join(",", activeProfiles) : "Default"; log.info("Active Profiles: {}", profiles); StringEncryptor encryptor = context.getBean(StringEncryptor.class); run(new EncryptionService(encryptor), context, encryptPrefix, encryptSuffix, decryptPrefix, decryptSuffix); }
Example #2
Source File: TabletMetadataConsole.java From timely with Apache License 2.0 | 6 votes |
public static void main(String[] args) throws Exception { try (ConfigurableApplicationContext ctx = new SpringApplicationBuilder(SpringBootstrap.class) .bannerMode(Banner.Mode.OFF).web(WebApplicationType.NONE).run(args)) { Configuration conf = ctx.getBean(Configuration.class); HashMap<String, String> apacheConf = new HashMap<>(); Accumulo accumuloConf = conf.getAccumulo(); apacheConf.put("instance.name", accumuloConf.getInstanceName()); apacheConf.put("instance.zookeeper.host", accumuloConf.getZookeepers()); ClientConfiguration aconf = ClientConfiguration.fromMap(apacheConf); Instance instance = new ZooKeeperInstance(aconf); Connector con = instance.getConnector(accumuloConf.getUsername(), new PasswordToken(accumuloConf.getPassword())); TabletMetadataQuery query = new TabletMetadataQuery(con, conf.getMetricsTable()); TabletMetadataView view = query.run(); System.out.println(view.toText(TimeUnit.DAYS)); } }
Example #3
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 #4
Source File: DaqStartup.java From c2mon with GNU Lesser General Public License v3.0 | 6 votes |
public static synchronized void start(String[] args) throws IOException { String daqName = getProperty("c2mon.daq.name"); if (daqName == null) { throw new RuntimeException("Please specify the DAQ process name using 'c2mon.daq.name'"); } // The JMS mode (single, double, test) is controlled via Spring profiles String mode = getProperty("c2mon.daq.jms.mode"); if (mode != null) { System.setProperty(AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME, mode); } if (application == null) { application = new SpringApplicationBuilder(DaqStartup.class) .bannerMode(Banner.Mode.OFF) .build(); } context = application.run(args); driverKernel = context.getBean(DriverKernel.class); driverKernel.init(); log.info("DAQ core is now initialized"); }
Example #5
Source File: RequestMonitor.java From curl with The Unlicense | 6 votes |
public static void start (final int port, final int managementPort, final boolean withSsl, final String [] args) { Map<String, Object> properties = new HashMap<String, Object>(); properties.put ("server.port", port); properties.put ("management.port", managementPort); if (withSsl) { properties.put ("server.ssl.key-store", "classpath:server/libe/libe.jks"); properties.put ("server.ssl.key-store-password", "myserverpass"); properties.put ("server.ssl.trust-store", "classpath:server/libe/libe.jks"); properties.put ("server.ssl.trust-store-password", "myserverpass"); properties.put ("server.ssl.client-auth", "need"); properties.put ("server.ssl.enabled-protocols","SSLv2,SSLv3,TLSv1.0,TLSv1.1,TLSv1.2"); } RequestMonitor.context = new SpringApplicationBuilder () .sources (RequestMonitor.class) .bannerMode (Banner.Mode.OFF) .addCommandLineProperties (true) .properties (properties) .run (args); }
Example #6
Source File: LocalPlatformTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void defaultLocalPlatform() { ApplicationContext context = new SpringApplicationBuilder(TestConfig.class) .web(WebApplicationType.NONE) .bannerMode(Banner.Mode.OFF) .properties(testProperties()) .run(); Map<String, TaskPlatform> taskPlatforms = context.getBeansOfType(TaskPlatform.class); assertThat(taskPlatforms).hasSize(1); TaskPlatform taskPlatform = taskPlatforms.values().iterator().next(); assertThat(taskPlatform.getName()).isEqualTo("Local"); assertThat(taskPlatform.getLaunchers()).hasSize(1); assertThat(taskPlatform.getLaunchers().get(0).getName()).isEqualTo("default"); assertThat(taskPlatform.getLaunchers().get(0).getType()).isEqualTo("Local"); assertThat(taskPlatform.getLaunchers().get(0).getTaskLauncher()).isInstanceOf(LocalTaskLauncher.class); }
Example #7
Source File: LocalPlatformTests.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Test public void multipleLocalPlatformAccounts() { ApplicationContext context = new SpringApplicationBuilder(TestConfig.class) .web(WebApplicationType.NONE) .bannerMode(Banner.Mode.OFF) .properties(testProperties( "spring.cloud.dataflow.task.platform.local.accounts[big].javaOpts=-Xmx2048m", "spring.cloud.dataflow.task.platform.local.accounts[small].javaOpts=-Xmx1024m")) .run(); Map<String, TaskPlatform> taskPlatforms = context.getBeansOfType(TaskPlatform.class); assertThat(taskPlatforms).hasSize(1); TaskPlatform taskPlatform = taskPlatforms.values().iterator().next(); assertThat(taskPlatform.getName()).isEqualTo("Local"); assertThat(taskPlatform.getLaunchers()).hasSize(2); assertThat(taskPlatform.getLaunchers()).extracting("type").containsExactly("Local","Local"); assertThat(taskPlatform.getLaunchers()).extracting("name").containsExactlyInAnyOrder("big", "small"); }
Example #8
Source File: SshShellRunnable.java From ssh-shell-spring-boot with Apache License 2.0 | 6 votes |
public SshShellRunnable(SshShellProperties properties, ChannelSession session, SshShellListenerService shellListenerService, Banner shellBanner, PromptProvider promptProvider, Shell shell, JLineShellAutoConfiguration.CompleterAdapter completerAdapter, Parser parser, Environment environment, org.apache.sshd.server.Environment sshEnv, SshShellCommandFactory sshShellCommandFactory, InputStream is, OutputStream os, ExitCallback ec) { this.properties = properties; this.session = session; this.shellListenerService = shellListenerService; this.shellBanner = shellBanner; this.promptProvider = promptProvider; this.shell = shell; this.completerAdapter = completerAdapter; this.parser = parser; this.environment = environment; this.sshEnv = sshEnv; this.sshShellCommandFactory = sshShellCommandFactory; this.is = is; this.os = os; this.ec = ec; }
Example #9
Source File: GeminiPostgresql.java From gemini with Apache License 2.0 | 6 votes |
@NotNull private static ConfigurableApplicationContext getGeminiRootContext(String[] args, Set<Class> coreBean) { logger.info("STARTING - GEMINI-ROOT CONTEXT "); SpringApplicationBuilder appBuilder = new SpringApplicationBuilder() .parent(AutoConfiguration.class, Gemini.class, AuthModule.class, GuiModule.class); if (coreBean.size() != 0) { appBuilder.sources(coreBean.toArray(new Class[0])); } ConfigurableApplicationContext root = appBuilder .web(WebApplicationType.NONE) .bannerMode(Banner.Mode.OFF) .run(args); root.setId("GEMINI-ROOT"); Gemini gemini = root.getBean(Gemini.class); gemini.init(); logger.info("STARTED - GEMINI-ROOT CONTEXT"); return root; }
Example #10
Source File: SshShellCommandFactory.java From ssh-shell-spring-boot with Apache License 2.0 | 6 votes |
/** * Constructor * * @param shellListenerService shell listener service * @param banner shell banner * @param promptProvider prompt provider * @param shell spring shell * @param completerAdapter completer adapter * @param parser jline parser * @param environment spring environment * @param properties ssh shell properties */ public SshShellCommandFactory(SshShellListenerService shellListenerService, @Autowired(required = false) Banner banner, @Lazy PromptProvider promptProvider, Shell shell, JLineShellAutoConfiguration.CompleterAdapter completerAdapter, Parser parser, Environment environment, SshShellProperties properties) { this.shellListenerService = shellListenerService; this.shellBanner = banner; this.promptProvider = promptProvider; this.shell = shell; this.completerAdapter = completerAdapter; this.parser = parser; this.environment = environment; this.properties = properties; }
Example #11
Source File: GeminiPostgresql.java From gemini with Apache License 2.0 | 6 votes |
public static void start(String[] args, Set<Class> coreBean, Set<Class> apiBean) { logger.info("***** STARTING GEMINI POSTRESQL MAIN *****"); ConfigurableApplicationContext root = getGeminiRootContext(args, coreBean); logger.info("STARTING - GEMINI-WEBAPP CONTEXT "); SpringApplicationBuilder webAppBuilder = new SpringApplicationBuilder() .parent(root).sources(Api.class).sources(GuiAPI.class, AuthModuleAPI.class, AutoConfiguration.class).web(WebApplicationType.SERVLET); if (apiBean.size() != 0) { webAppBuilder.sources(apiBean.toArray(new Class[0])); } ConfigurableApplicationContext gui = webAppBuilder.bannerMode(Banner.Mode.OFF) .run(args); gui.setId("GEMINI-WAPP"); logger.info("STARTED - GEMINI-WEBAPP CONTEXT"); }
Example #12
Source File: CacheDemoApplication.java From AutoLoadCache with Apache License 2.0 | 6 votes |
private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) { ApplicationListener<ApplicationReadyEvent> readyListener=new ApplicationListener<ApplicationReadyEvent> () { @Override public void onApplicationEvent(ApplicationReadyEvent event) { ConfigurableApplicationContext context = event.getApplicationContext(); UserMapper userMapper=context.getBean(UserMapper.class); userMapper.allUsers(); UserCondition condition = new UserCondition(); PageRequest page =new PageRequest(1, 10); condition.setPageable(page); condition.setStatus(1); userMapper.listByCondition(condition); } }; return builder.sources(CacheDemoApplication.class).bannerMode(Banner.Mode.OFF).listeners(readyListener); }
Example #13
Source File: HbaseSchemaManager.java From pinpoint with Apache License 2.0 | 6 votes |
public static void main(String[] args) { ProgramCommand programCommand = ProgramCommand.parseArgs(args); if (programCommand == ProgramCommand.EMPTY) { printHelp(); return; } Command command = Command.fromValue(programCommand.getCommand()); if (command == null) { LOGGER.info(Markers.TERMINAL, "'{}' is not a valid command.", programCommand.getCommand()); printHelp(); return; } if (command == Command.HELP) { printHelp(); return; } SpringApplication application = new SpringApplication(HbaseSchemaManager.class); application.setBannerMode(Banner.Mode.OFF); application.run(args); }
Example #14
Source File: SpringBootRunnerTest.java From herald with Apache License 2.0 | 5 votes |
@Test public void checkAppRunner() { final ApplicationContext context = new SpringApplicationBuilder() .headless(true) .logStartupInfo(false) .bannerMode(Banner.Mode.OFF) .sources(SpringBootTestContext.class) .run(); assertThat(context, notNullValue()); }
Example #15
Source File: RubricsApplication.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Required per http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html * in order produce a traditional deployable war file. * * @param application * @return */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { ConfigurableApplicationContext sharedAc = ((SpringCompMgr) ComponentManager.getInstance()).getApplicationContext(); application.parent(sharedAc); return application.bannerMode(Banner.Mode.OFF).sources(RubricsApplication.class); }
Example #16
Source File: ShellCommandsTests.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
/** * Runs shell with given command files, waits 1 min for completion * @param commandFiles */ private boolean runShell(String commandFiles) { String dataFlowUri = applicationContext.getEnvironment().getProperty("dataflow.uri"); ExecutorService executorService = Executors.newFixedThreadPool(1); Future<?> completed = executorService.submit(() -> { new SpringApplicationBuilder(ShellApp.class) .web(WebApplicationType.NONE) .bannerMode(Banner.Mode.OFF) .run( "--spring.shell.command-file=" + commandFiles, "--spring.cloud.config.enabled=false", "--spring.autoconfigure.exclude=" + Stream.of(SessionAutoConfiguration.class, DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class) .map(Class::getName) .collect(Collectors.joining(",")), "--dataflow.uri=" + dataFlowUri ); }); try { completed.get(60, TimeUnit.SECONDS); return true; } catch (Throwable e) { // return false; // TODO: BOOT2 we're getting app run error. Might be something to do with reordering of events when boot runs an app. // There's checks for app run result so for now just return true. // o.s.b.SpringApplication:845 - Application run failed // java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@377f9cb6 has been closed already // return true; } finally { executorService.shutdownNow(); } }
Example #17
Source File: KafDrop.java From Kafdrop with Apache License 2.0 | 5 votes |
public static void main(String[] args) { new SpringApplicationBuilder(KafDrop.class) .bannerMode(Banner.Mode.OFF) .listeners(new LoggingConfigurationListener()) .run(args); }
Example #18
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 #19
Source File: ShellBanner.java From sshd-shell-spring-boot with Apache License 2.0 | 5 votes |
private void addBanner(ResourceLoader resourceLoader, String bannerResourceName, Function<Resource, Banner> function) { Resource bannerResource = resourceLoader.getResource(bannerResourceName); if (bannerResource.exists()) { banners.add(new BannerDecorator(function.apply(bannerResource))); } }
Example #20
Source File: StupidHttpServer.java From curl with The Unlicense | 5 votes |
public static void start (final int port, final int managementPort, final String [] args) { Map<String, Object> properties = new HashMap<String, Object> (); properties.put ("server.port", port); properties.put ("management.port", managementPort); StupidHttpServer.context = new SpringApplicationBuilder ().sources (StupidHttpServer.class).bannerMode (Banner.Mode.OFF).addCommandLineProperties (true).properties (properties).run (args); }
Example #21
Source File: LayuiAdminStartUp.java From layui-admin with MIT License | 5 votes |
public static void main(String[] args) { SpringApplication app = new SpringApplication(LayuiAdminStartUp.class); app.setBannerMode(Banner.Mode.OFF); app.setWebApplicationType(WebApplicationType.SERVLET); Set<String> sources = new HashSet<String>(); sources.add("classpath:applicationContext.xml"); app.setSources(sources); app.run(args); }
Example #22
Source File: LogFeeder.java From ambari-logsearch with Apache License 2.0 | 5 votes |
public static void main(String[] args) { String pidFile = System.getenv("LOGFEEDER_PID_FILE") == null ? "logfeeder.pid" : System.getenv("LOGFEEDER_PID_FILE"); new SpringApplicationBuilder(LogFeeder.class) .bannerMode(Banner.Mode.OFF) .listeners(new ApplicationPidFileWriter(pidFile)) .run(args); }
Example #23
Source File: ParaServer.java From para with Apache License 2.0 | 5 votes |
/** * This is the initializing method when running ParaServer as executable JAR (or WAR), * from the command line: java -jar para.jar. * @param args command line arguments array (same as those in {@code void main(String[] args)} ) * @param sources the application classes that will be scanned */ public static void runAsJAR(String[] args, Class<?>... sources) { // entry point (JAR) SpringApplication app = new SpringApplication(sources); app.setAdditionalProfiles(Config.ENVIRONMENT); app.setWebApplicationType(WebApplicationType.SERVLET); app.setBannerMode(Banner.Mode.OFF); if (Config.getConfigBoolean("pidfile_enabled", true)) { app.addListeners(new ApplicationPidFileWriter(Config.PARA + "_" + getServerPort() + ".pid")); } initialize(getCoreModules()); app.run(args); }
Example #24
Source File: SpringApplicationStarter.java From x-pipe with Apache License 2.0 | 5 votes |
public SpringApplicationStarter(Object resource, int port, int maxThreads) { application = new SpringApplication(resource); application.setBannerMode(Banner.Mode.OFF); this.port = port; this.maxThreads = maxThreads; application.setEnvironment(createEnvironment()); }
Example #25
Source File: DubboBannerApplicationListener.java From dubbo-spring-boot-starter with Apache License 2.0 | 5 votes |
@Override public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { if (BANNER_MODE == Banner.Mode.OFF) { return; } String bannerText = this.buildBannerText(); if (BANNER_MODE == Mode.CONSOLE) { System.out.print(bannerText); } else if (BANNER_MODE == Mode.LOG) { logger.info(bannerText); } }
Example #26
Source File: StreamSuiteMain.java From PoseidonX with Apache License 2.0 | 5 votes |
public static void main(String[] args) throws IOException, InterruptedException { LOGGER.error("###################"); SpringApplication app = new SpringApplication(StreamSuiteMain.class); app.setAdditionalProfiles(); app.setBannerMode(Banner.Mode.CONSOLE); app.run(args); LOGGER.error("StreamSuiteMain ---started"); }
Example #27
Source File: StartApplication.java From Jantent with MIT License | 5 votes |
public static void main(String[] args) throws Exception{ SpringApplication app = new SpringApplication(StartApplication.class); app.setBannerMode(Banner.Mode.OFF); app.setBannerMode(Banner.Mode.OFF); app.run(args); }
Example #28
Source File: Application.java From iot-dc with Apache License 2.0 | 5 votes |
public static void main(String[] args) { new SpringApplicationBuilder() .banner(new TheEmbersBanner()) .bannerMode(Banner.Mode.LOG) .sources(Application.class) .run(args); }
Example #29
Source File: HerdMetastore.java From herd-mdl with Apache License 2.0 | 5 votes |
public static void main( String args[] ) { SpringApplication app = new SpringApplication( HerdMetastore.class, HerdMetastoreConfig.class ); app.setBannerMode( Banner.Mode.OFF ); ConfigurableApplicationContext ctx = app.run( args ); ObjectProcessor objectProcessor = ctx.getBean( ObjectProcessor.class ); objectProcessor.runJobs(); }
Example #30
Source File: TheEmbersBanner.java From iot-dc with Apache License 2.0 | 5 votes |
@Override public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) { for (String line : BANNER) { out.println(AnsiOutput.toString(BRIGHT_BLUE, line)); } String version = Banner.class.getPackage().getImplementationVersion(); version = (version == null ? "" : " (v" + version + ")..."); out.println(AnsiOutput.toString(BRIGHT_YELLOW, SPRING_BOOT, version)); out.println(); }