本文整理汇总了Java中org.springframework.boot.builder.SpringApplicationBuilder.run方法的典型用法代码示例。如果您正苦于以下问题:Java SpringApplicationBuilder.run方法的具体用法?Java SpringApplicationBuilder.run怎么用?Java SpringApplicationBuilder.run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.boot.builder.SpringApplicationBuilder
的用法示例。
在下文中一共展示了SpringApplicationBuilder.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("hi-log-log4j2 start successfully");
String a = "哈哈";
while (true) {
LOGGER.info("i am test, {}", a);
Thread.sleep(1000);
}
}
示例2: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector trace start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("rpcTraceTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例3: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector indexer start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("indexerTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例4: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector backup start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("backupTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例5: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
ConfigurableApplicationContext context = builder.run(args);
LOGGER.info("collector metrics start successfully");
KafkaConsumer kafkaConsumer = (KafkaConsumer<byte[], String>) context.getBean("kafkaConsumer");
Task task = (Task) context.getBean("metricsTask");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new ShutdownHookRunner(kafkaConsumer, task));
task.doTask();
}
示例6: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(final String... args) {
final SpringApplicationBuilder sab = new SpringApplicationBuilder(__main_stub.class)
.headless(false)
.web(false);
try (ConfigurableApplicationContext ctx = sab.run(args)) {
LOG.info("STUB CLASS. USELESS EXCEPT FOR A FEW CONFIG THINGS.");
throw new RuntimeException("NOT TO BE EXECUTED");
}
}
示例7: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务C start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例8: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务B start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例9: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务E start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例10: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("服务D start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例11: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("接口A start successfully");
}
示例12: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("alarm start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例13: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Application.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("web start successfully");
}
示例14: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
public static void main(String[] args) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(Launcher.class);
Set<ApplicationListener<?>> listeners = builder.application().getListeners();
for (Iterator<ApplicationListener<?>> it = listeners.iterator(); it.hasNext();) {
ApplicationListener<?> listener = it.next();
if (listener instanceof LoggingApplicationListener) {
it.remove();
}
}
builder.application().setListeners(listeners);
builder.run(args);
LOGGER.info("monitor start successfully");
// 优雅停止项目
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
LOGGER.info("try to stop the system");
synchronized (Launcher.class) {
RUNNING = false;
Launcher.class.notify();
}
}
});
synchronized (Launcher.class) {
while (RUNNING) {
try {
Launcher.class.wait();
} catch (InterruptedException e) {
LOGGER.error("wait error");
e.printStackTrace();
}
}
}
}
示例15: main
import org.springframework.boot.builder.SpringApplicationBuilder; //导入方法依赖的package包/类
/**
* 启动项目DiscoveryClientService
*/
public static void main(String[] args) {
SpringApplicationBuilder springApplication = new SpringApplicationBuilder(FileServiceApplication.class);
springApplication.web(true);
springApplication.run(args);
}