jboss 上的 Spring Boot 部署问题 [英] Spring boot deployment issue on jboss

查看:30
本文介绍了jboss 上的 Spring Boot 部署问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 jboss 上部署 spring boot 项目后,除了我的 schdule 任务之外,一切都很好.我在我的日程安排方法类上用 @enablescheduling 和 @component 注释了我的主类,在我的方法上用 @scheduled 注释了我的主类.但是在成功运行后没有错误在 jboss 上,我的计划任务没有触发.我真的需要一个解决方案.Tnx 每个身体下面是我的配置类和我的日程安排类:

After deploying spring boot project on jboss ,every things work great except my schdule task.i have annotated my main class with @enablescheduling and @component on my schedule method class and @scheduled on my method.but after running successfuly without error on jboss ,my schedule task does not fire.i really need a solution. Tnx every body Below is my config class and my schedule classes:

@SpringBootApplicatio
@Enablescheduling
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
      SpringApplication.run(Application.class);              

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
}
}

@component
Public class test{
@scheduled(fixedDelay = 1000)
Public void print(){
//do sth
}

}

推荐答案

好的,我们发现了一个问题.在我们的例子中,将 initialDelay 设置为 10000 毫秒解决了这个问题.不知道解释,但仍然:它有效.

Ok, we've found an issue. Setting initialDelay to 10000 ms resolved the problem in our case. Don't know an explanation but still: it works.

这篇关于jboss 上的 Spring Boot 部署问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆