spring boot 启动脚本
启动的时候 在 boot_class 中有个:com.sankuai.qcs.regulation.shanghai.App 这是spring boot的配置,在 bin/run_main.sh中 有配置:
${EXEC_JAVA} ${boot_class} 2>&1
这样在启动的时候就会走:方法:
com.sankuai.qcs.regulation.shanghai.App;
里面的main方法; 在main里面有个:
classpath:application.xml; 在application.xml中有个:添加了注解的标签:
<task:annotation-driven/> 所以开始使用注解初始化:
com.sankuai.qcs.regulation.shanghai.service.impl;里面的方法:
@PostConstruct
private void start() {
try {
Properties successTopicProps = new Properties();
successTopicProps.setProperty(ConsumerConstants.MafkaBGNamespace, "waimai");
successTopicProps.setProperty(ConsumerConstants.MafkaClientAppkey, "com.sankuai.qcs.data.integration");
callBackProducer = MafkaClient.buildProduceFactory(successTopicProps, "dache.regulation.traffic.data"); Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
batchSendTask();
}
}, , );
} catch (Throwable throwable) {
LOGGER.error("BatchSendService#start init mafka producer error", throwable);
}
}
请注意前面有个:
@PostConstruct 它的意思是在加载bean的时候就开始 先执行方法:
start 然后在pom.xml中有个:
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<finalName>qcs.service.regulation</finalName>
<classesDirectory>target/classes/</classesDirectory>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifest>
<mainClass>com.sankuai.qcs.regulation.shanghai.App</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
里面的mainClass指的是:这个插件在在打包的时候要调用mainClass;
spring boot 启动脚本的更多相关文章
- 启动/关闭Spring boot服务脚本
启动Spring boot服务脚本 #!/bin/bash cd /test java -jar test.jar &> ./test.log & echo "成功&q ...
- Spring Boot启动流程分析
引言 早在15年的时候就开始用spring boot进行开发了,然而一直就只是用用,并没有深入去了解spring boot是以什么原理怎样工作的,说来也惭愧.今天让我们从spring boot启动开始 ...
- Spring Boot -- 启动彩蛋
使用Spring Boot启动的jar包总是会显示一个Spring的图标: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\_ ...
- Spring Boot 启动原理分析
https://yq.aliyun.com/articles/6056 转 在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启 ...
- Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动
之前在Spring Boot启动过程(二)提到过createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat. private void cr ...
- Spring Boot启动过程(七):Connector初始化
Connector实例的创建已经在Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动中提到了: Connector是LifecycleMBeanBase的子类,先是设置L ...
- spring boot 启动问题
spring boot启动报错误 Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.co ...
- Spring Boot 启动(四) EnvironmentPostProcessor
Spring Boot 启动(四) EnvironmentPostProcessor Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698. ...
- Spring Boot 启动(二) 配置详解
Spring Boot 启动(二) 配置详解 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring Boot 配置 ...
随机推荐
- A. Many Equal Substrings(水题)
思路: 直接比较橘色框里的取第一次相等,即可. #include<iostream> #include<string> using namespace std; string ...
- P1184 高手之在一起(字典树模板题,hash算法, map)
哎,唯一值得说明的是,这道题的输入有bug 先把字典树的算法模板放一下 #include<iostream> #include<cstring> using namespace ...
- springboot--bean交给容器
1.把bean交给springboot管理 springboot也是一个spring容器.把一个bean交给springboot的容器有三种方法,前两种是先把bean交给spring容器再把sprin ...
- C语言之建立线性表
#include<stdio.h> #include<stdlib.h> #define MaxSize 60 #define ElemType int typedef str ...
- AI SSD目标检测算法
Single Shot multibox Detector,简称SSD,是一种目标检测算法. Single Shot意味着SSD属于one stage方法,multibox表示多框预测. CNN 多尺 ...
- Java多线程(七)——线程休眠
一.sleep()介绍 sleep() 定义在Thread.java中.sleep() 的作用是让当前线程休眠,即当前线程会从“运行状态”进入到“休眠(阻塞)状态”.sleep()会指定休眠时间,线程 ...
- redis底层设计(五)——内部运作机制
5.1 数据库 5.1.1 数据库的结构: Redis 中的每个数据库,都由一个redis.h/redisDb 结构表示: typedef struct redisDb { // 保存着数据库以整数表 ...
- Git&Github基本操作与分支管理
Git的原理涉及快照流.链表.指针等,这里不作过多叙述. 1.基本操作 git init 创建一个 Git 仓库 git clone [url] 拷贝一个 Git 仓库到本地 git add [fil ...
- Webpack+Typescript 简易配置
教程:https://www.cnblogs.com/yasepix/p/9294499.html http://developer.egret.com/cn/github/egret-docs/ex ...
- OpenStack 与 Rancher
OpenStack 与 Rancher 融合的新玩法 - Rancher - SegmentFault 思否https://segmentfault.com/a/1190000007965378 Op ...