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 配置 ...
随机推荐
- CSAPP:第一章计算机系统漫游
CSAPP:计算机系统漫游 关键点:上下文.程序运行.计算机系统抽象. 信息就是位+上下文一个程序的运行过程系统的硬件组成编译系统是如何工作的?一个程序的运行过程(c语言举例)计算机系统中的抽象 信息 ...
- Oracle使用数据泵 (expdp/impdp)实施迁移
实验环境: 1.导出环境:RedHat6.4+Oracle 11.2.0.4.0,利用数据库自带的scott示例用户进行试验测试. Directory:wjq à /tmp/seiang_wjq 2. ...
- forall 与 for loop 案例
create table a_tab(ver number,id number);create table b_tab(ver number,id number);set timing on DECL ...
- 0、原生jdbc工厂类
一.代码结构 二.JDBCFactory.java package com.test; import java.io.IOException; import java.io.InputStream; ...
- .NET中使用Redis 转发
.NET中使用Redis Redis是一个用的比较广泛的Key/Value的内存数据库,新浪微博.Github.StackOverflow 等大型应用中都用其作为缓存,Redis的官网为http: ...
- js同步-异步-回调
出处:https://blog.csdn.net/u010297791/article/details/71158212(1)上面主要讲了同步和回调执行顺序的问题,接着我就举一个包含同步.异步.回调的 ...
- python:利用logbook模块管理日志
日志管理作为软件项目的通用部分,无论是开发还是自动化测试过程中,都显得尤为重要. 最初是打算利用python的logging模块来管理日志的,后来看了些github及其他人的自动化框架设计,做了个比对 ...
- Linux中断管理 (3)workqueue工作队列
目录: <Linux中断管理> <Linux中断管理 (1)Linux中断管理机制> <Linux中断管理 (2)软中断和tasklet> <Linux中断管 ...
- javaweb 项目启动问题:Application Server was not connected before run configuration stop, reason: javax.manage
参考:https://blog.csdn.net/whm18322394724/article/details/80290187 换成本机的jre就行了(路径要正确,特别是项目迁移的时候有时候用环境变 ...
- 2小时学会Spring Boot(IDE:eclipse)
一:安装STS插件 官网下载:点此下载STS 注意:STS版本必须与eclipse版本对应 安装教程:http://blog.csdn.net/cryhelyxx/article/details/53 ...