启动的时候 在 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 启动脚本的更多相关文章

  1. 启动/关闭Spring boot服务脚本

    启动Spring boot服务脚本 #!/bin/bash cd /test java -jar test.jar &> ./test.log & echo "成功&q ...

  2. Spring Boot启动流程分析

    引言 早在15年的时候就开始用spring boot进行开发了,然而一直就只是用用,并没有深入去了解spring boot是以什么原理怎样工作的,说来也惭愧.今天让我们从spring boot启动开始 ...

  3. Spring Boot -- 启动彩蛋

    使用Spring Boot启动的jar包总是会显示一个Spring的图标: . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\_ ...

  4. Spring Boot 启动原理分析

    https://yq.aliyun.com/articles/6056 转 在spring boot里,很吸引人的一个特性是可以直接把应用打包成为一个jar/war,然后这个jar/war是可以直接启 ...

  5. Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动

    之前在Spring Boot启动过程(二)提到过createEmbeddedServletContainer创建了内嵌的Servlet容器,我用的是默认的Tomcat. private void cr ...

  6. Spring Boot启动过程(七):Connector初始化

    Connector实例的创建已经在Spring Boot启动过程(四):Spring Boot内嵌Tomcat启动中提到了: Connector是LifecycleMBeanBase的子类,先是设置L ...

  7. spring boot 启动问题

    spring boot启动报错误 Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.co ...

  8. Spring Boot 启动(四) EnvironmentPostProcessor

    Spring Boot 启动(四) EnvironmentPostProcessor Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698. ...

  9. Spring Boot 启动(二) 配置详解

    Spring Boot 启动(二) 配置详解 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) Spring Boot 配置 ...

随机推荐

  1. 當 Alexa 遇上 ESP8266 (一)

    https://www.birdandgua.net/bird/2017/12/when_alexa_meets_esp8266-1/ 去年的 AWS 的 re:Invent 上,我見識了 Alexa ...

  2. java kafka单列模式生产者客户端

    1.所需要的依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="ht ...

  3. Run Redis

    Cmd window enter console Cd\ E: Cd E:\Graduration\Redis\github Run redis for window 64 After cmd ent ...

  4. Eclipse下关于The serializable class UsersServlet does not declare a static final serialVersionUID field of type的警告

    The serializable class XXX does not declare a static final serialVersionUID field of type long seria ...

  5. Rollup处理并打包JS文件项目实例

    关于Rollup rollup是一款用来es6模块打包代码的构建工具(支持css和js打包).当我们使用ES6模块编写应用或者库时,它可以打包成一个单独文件提供浏览器和Node.js来使用. 它的优点 ...

  6. 接口自动化框架(Pytest+request+Allure)

    前言: 接口自动化是指模拟程序接口层面的自动化,由于接口不易变更,维护成本更小,所以深受各大公司的喜爱. 接口自动化包含2个部分,功能性的接口自动化测试和并发接口自动化测试. 本次文章着重介绍第一种, ...

  7. 使用insert ignore来避免向数据库重复插入数据

    mysql中 insert ignore 的使用示例如下: INSERT IGNORE INTO `table_name` (`reportid`, `content`) VALUES (‘11111 ...

  8. H5 表单标签

    33-表单标签3 列表数据 注意点: 1.下拉列表不能输入内容, 但是可以直接在列表中选择内容 2.可以通过给option标签添加一个selected属性来指定列表的默认值 3.可以通过给option ...

  9. D - Nature Reserve(cf514,div2)

    题意:给出n(n<=1e5)个点,求一个最小的圆,与x轴相切,并且包含这n个点 思路:我第一想到的是,这个圆一定会经过一个点,再根据与x轴相切,我们可以找到最小的圆,让它包含其余的点,但是如何判 ...

  10. Python学习第二篇

    list_num=list(range(1,1000001)) print(min(list_num)) print(max(list_num)) print(sum(list_num)) print ...