SpringBoot项目非web方式启动

SpringBoot 移除内嵌Tomcat。使用非web方式启动 前言:当我们使用Spring Boot编写了一个批处理应用程序,该程序只是用于后台跑批数据,此时不需要内嵌的tomcat,简化启动方式使用非web方式启动项目,步骤如下: 1、修改pom.xml文件 在pom.xml文件中去除内嵌tomcat,添加servlet依赖 <dependency> <groupId>org.springframework.boot</groupId> <artif. 阅读详情

1、springboot 1.x中以非web方式启动

@SpringBootApplication  
public class Application implements ApplicationRunner{  
  
    public static void main(String[] args) {  
        new SpringApplicationBuilder()  
            .sources(Application.class).web(false).run(args);  
    }  
  
    @Override  
    public void run(ApplicationArguments args) throws Exception {  
        while(true) {  
            System.out.println("now is " + new Date().toLocaleString());  
        Thread.sleep(1000);  
    }  
    }  
  
}  

2、springboot 2.x中以非web方式启动
-web(false)/setWebEnvironment(false) is deprecated and instead Web-Application-Type can be used to specify

a. 在配置文件中加入: 

spring.main.web-application-type=NONE

b. 启动类中修改:

@SpringBootApplication  
public class Application implements ApplicationRunner{  
  
    public static void main(String[] args) {  
        new SpringApplicationBuilder(Application.class)  
            .web(WebApplicationType.NONE) // .REACTIVE, .SERVLET  
            .bannerMode(Banner.Mode.OFF)  
            .run(args);  
    }  
  
    @Override  
    public void run(ApplicationArguments args) throws Exception {  
        while(true) {  
            System.out.println("now is " + new Date().toLocaleString());  
            Thread.sleep(1000);  
        }  
    }  
      
}         

 

论文分享 - OctoMap八叉树建图原理 论文:OctoMap:An Efficient Probabilistic 3D Mapping Framework Based on Octrees。 阅读详情

相关推荐

simulink可控励磁同步电机模型分析

他励同步电机模型分析

qq_26681609的博客 5552

如何在Spring Boot中不启动Web Server

如何在Spring Boot中不启动Web Server 1.介绍 Spring Boot是一个用于为各种应用快速创建新的Java应用程序的优秀框架。最流行的用途之一是作为web服务器。 但是,Spring Boot有许多不需要web服务器的场景:控制台应用程序、作业调度、批处理或流处理、无服务器应用程序等等。在本教程中,我们将介绍几种不用web服务器就可以使用Spring Boot的不同方法。 2.依赖管理 防止Spring引导应用程序启动嵌入式web服务器的最简单方法是不将web服务器启动器包含在我们的

kerongao的博客 8682

DolphinScheduler工作流中ChunJun任务保存失败的深度解析与实战修复

本文深度解析了在DolphinScheduler工作流中创建ChunJun任务时遭遇“parameter invalid”保存失败的普遍问题。其根源在于前端表单的`customConfig`参数默认值与后端校验逻辑不匹配。文章提供了两种实战修复方案:一是修改前端源码并重新编译,二是热更新已部署的JS文件,并对比了其适用场景与风险,帮助用户彻底解决此集成障碍。

weixin_29010003的博客 397

Spring boot2.0 入门(九)-无Web启动工程

import org.springframework.boot.CommandLineRunner; import org.springframework.boot.SpringApplication; import org.springframework.boot.WebApplicationType; import org.springframework.boot.autoconfigure....

u011311291的博客 583

详解MegatronLM序列模型并行训练(Sequence Parallel)

MegatronLM的第三篇论文是2022年出的。在大模型训练过程中显存占用过大往往成为瓶颈,一般会通过recomputation重计算的方式降低显存占用,但会带来额外的计算代价。这篇论文提出了两种方法,分别是和,这两种方法和Tensor并行是可以相结合的,可以有效减少不必要的计算量。下图中绿色部分表示不同模型中需要用于保存activation需要的显存大小,蓝色部分表示不同模型中需要用于保存parameter和optimizer state需要的显存大小。红色线表示A100的显存大小80G。

分享机器学习、深度学习、分布式计算、MLSys相关领域知识 1万+

图解链表 —— JAVA中的单链表基本操作

文章目录1. 什么是链表2. 链表的种类3. 创建单链表3.1 创建 Node 类(车厢类)3.2 创建 MySingleList (火车类)4. 单链表的基本操作4.1 增加链表元素4.1.1 在链表头部添加元素4.1.2 在链表任意位置添加元素4.1.3 在链表尾部添加元素4.2 删除链表元素4.2.1 删除第一个节点元素4.2.2 删除任意位置 index 元素4.2.3 删除链表中指定元素的第一个节点4.2.4 删除链表的所有指定元素4.3 查找链表元素4.3.1 判断链表中是否包含元素 data4

AlinaQ05的博客 2502

spring boot 如何设置为不为web方式启动

package com.cloudtech.demo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner;...

程序猿学社的博客 2万+

最新Python爬虫实战(入门爬虫篇)——案例18:某气象局全国天气预报数据采集(详细爬虫思路截图 + 抓包动图演示+完整爬虫代码+详细注释)

本次案例针对某气象局天气预报网的静态HTML页面,实现了全国各地区天气数据的全自动化爬取,和之前案例17的动态接口爬虫不同,本次案例聚焦于静态页面的爬虫实现,覆盖了从抓包分析、请求模拟、数据解析到数据存储的完整爬虫流程,非常适合入门学习者巩固基础,核心知识点和实现要点总结如下:首先是页面分析的核心逻辑,静态HTML页面的数据爬取,核心在于通过浏览器开发者工具,完成完整的抓包分析和标签结构定位。

努力让自己发光,对的人才能迎着光而来 27万+

SpringBoot启动源码分析

个人博客导航页(点击右侧链接即可打开个人博客):大牛带你入门技术栈 SpringBoot自启动源码分析 项目启动代码 public static void main(String[] args) { // springboot项目启动方式 SpringApplication.run(DemoApplication.class, args); ...

JKX_geek的博客 370

Unity-Mirror网络框架-从入门到精通之MultipleMatches示例

Multiple Matches 示例主要讲述了如何在使用 Mirror 网路框架时管理多个游戏匹配。以及如何设置一个能够同时支持多个游戏会话的系统,使玩家能够加入他们所选择的比赛,而不是强制他们加入一个单一的匹配。

TxNet 965

【全局路径规划模块全覆盖算法】(三)代码实现:Boustrophedon Cellular Decomposition Path Planning用珊格地图生成每个cell的覆盖路径

认知有限,望大家多多包涵,有什么问题也希望能够与大家多交流,共同成长!本文先对Boustrophedon Cellular Decomposition Path Planning用珊格地图生成每个cell的覆盖路径做个简单的介绍,具体内容后续再更,其他模块可以参考去我其他文章提示:以下是本篇文章正文内容。

qq_35635374的博客 1833

Springboot非web项目启动(本地)

无

z69183787的专栏 3287

【测绘程序设计】——潮汐调和分析

最小二乘潮汐调和分析源码、使用示例及数据

C_xxy's blog 2653

javaweb项目与非web项目以及tomcat

有两类项目,被调用的项目 或者 执行一些自身操作(如:定时任务) 被调用的项目(浏览器请求),是web项目,web项目需要web容器,例如tomcat,Weblogic等。通过http请求来触发相关的服务。 非web项目,不需要web容器。 问题:springBoot项目是否可以创建非web项目。 springboot可以创建非web项目. SpringBoot自动判断项目是否是Web项目,比如我们平常只要引入spring-boot-starter-web依赖,SpringBoot就会把项目设置为We.

blue 1746

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Spring Boot移除内嵌Tomcat,使用非web方式启动

系列文章目录 提示:这里可以添加系列文章的所有文章的目录,目录需要自己手动添加 例如:第一章 Python 机器学习入门之pandas的使用 提示:写完文章后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录系列文章目录前言一、执行步骤1.在pom.xml文件中去除内嵌tomcat,添加servlet依赖2.在pom.xml文件中将打项目包方式设置成jar,打成jar包通过命令去执行jar3.对于非Web应用程序,请在属性文件中禁用Web应用程序类型,application.yml文件中添加4.在

南国以南i的博客 3111

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

linux、windows下java项目启动脚本汇总

平时开发java项目时,直接命令启动很不方便,而且脚本在linux和windows下还不同,为了方便以后使用,所以经过实测总结了下面四个脚本(以springboot项目进行的测试)。 1、windows下启动脚本 %1 mshta vbscript:CreateObject("WScript.Shell").Run("%~s0 ::",0,FALSE)(window.close)&&exit java -Xms512m -jar E:\scripts\wyt01sbdemo-0.0...

Interest1_wyt的博客 667

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

java web tomcat 删除_Spring Boot如何移除内嵌Tomcat,使用非web方式启动

前言:当我们使用Spring Boot编写了一个批处理应用程序,该程序只是用于后台跑批数据,此时不需要内嵌的tomcat,简化启动方式使用非web方式启动项目,步骤如下:1、修改pom.xml文件在pom.xml文件中去除内嵌tomcat,添加servlet依赖org.springframework.bootspring-boot-starter-weborg.springframework.bo...

weixin_26516551的博客 604

java非web程序框架_Spring Boot非web应用程序的创建方式

Spring Boot是一个全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程,Spring Boot框架使java程序员在开发时不需要定义样板化的配置,这使得Spring Boot十分流行,这篇文章来介绍关于Spring Boot非web应用程序该怎样创建的问题,解决大家关于Spring Boot非web应用程序在框架中创建的疑问。有时候一些项目并不需要提供web服务,例如跑...

weixin_42715608的博客 629

SpringBoot--编程--非注解

SpringBoot项目非web方式启动 参考网址:SpringBoot项目非web方式启动 - 一切随风 - ITeye博客 1、springboot 1.x中以非web方式启动 @SpringBootApplication public class Application implements ApplicationRunner{ public static void mai...

IT利刃出鞘的博客 964

springboot web项目获取resources打包后的文件_快速开发Spring Boot应用

越来越多的Java应用基于Spring Boot,那么如何快速创建应用并开发部署呢?创建项目方式一:Spring InitializrSpring initializr是Spring官网提供的工具,只要选择Spring Boot版本,输入项目信息,就会自动生成项目工程,用Eclipse或Ideal导入,即可开始。Spring Initializr网址:start.spring.io方式二:引入Sp...

weixin_39966225的博客 348

java web启动执行_web项目启动时,自动执行代码的几种方式

在项目开发过程中,往往需要一些功能随着项目启动而优先启动,下面我总结几种方式(非spring boot) spring boot的参考spring boot 学习之路9 (项目启动后就执行特定方法)方式一: ServletContextListener监听器,不懂监听器的可以去网上百度一下servlet的监听器java 代码如下:package com.deifeng.huhy.common...

weixin_39528467的博客 619

Java运行非Web的Springboot项目(测试类或启动主类两种方法)

Java运行非Web的Springboot项目(测试类或启动主类两种方法)前言一、创建打开一个Springboot项目二、运行项目1、Test测试类运行2、启动主类运行三、持续运行不停止(定时任务、自动执行)总结 前言 如果springboot不是一个Web项目,大家知道,项目启动以后马上就会停止,并且 controller 等各层里面的方法也不会被执行,下面有两种方式可以运行容器里面的方法,测试类或者修改启动主类,都非常简单,几行代码的事情。 一、创建打开一个Springboot项目 使用idea,选

泡泡的博客 5925

springboot非web项目启动

问题 想要写一个单纯的跟redis交互的demo,但是在springboot非web项目启动完成之后,项目直接关闭,且无异常抛错 解决 在网上搜索了集中解决方案 修改webApplicationType 写在配置文件中: spring: main: web-application-type: none 写在启动类中 public static void main(Strin...

eve_z的博客 4403

SpringBoot的web项目启动方式

SpringBoot的web项目启动方式 第一种(本地开发使用) 在项目的根目录下有一个带有main函数的Application类,可以直接执行这个main函数。(使用的是SpringBoot内置的tomcat) 即点击main函数左边的运行按钮即可。 第二种(本地开发使用) 在pom文件中配置使用启动SpringBoot的maven插件。配置如下 <build> <plugins> <plugin>

thinkhi9999的博客 5080

SprngBoot项目内部tomcat没有启动(springboot 设置web和非web启动)

springBoot区分web和非web项目 老版本: #server config #web_environment是否是web项目 spring.main.web_environment=true #是否加载springboot banner spring.main.show_banner=false 现版本: #server config #是否设定web应用,none-非web,ser...

闵浮龙的博客 2186

springboot+mybatis 非web项目构建

  环境:java8 idea macos 第一步,新建项目: 点击next,后填写一些信息。 之后点击next,选择sql下的mybatis 点击next,点击finish 至此项目搭建完毕。结构如下图所示: 接下来要做的是写一个简单的连接数据库的查询。并运行起来程序。 首先修改配置文件 application.properties spring.data...

wlittlefive的博客 8602
上一篇: mongo日志按日期分隔
下一篇: spring aop 使用
who7708
博客等级 码龄16年 8粉丝 35原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值