首页 > 解决方案 > 在 Tomcat 上的 Eclipse 中启动 Springboot 应用程序

问题描述

我正在尝试在 Eclipse 的嵌入式 Tomcat 服务器上运行 springboot 应用程序。该项目已成功添加到服务器,但它永远不会启动。

我的应用程序代码如下:

import java.util.Properties;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ImportResource;
import org.springframework.boot.Banner;
@SpringBootApplication
@ImportResource("classpath:simple-camel.xml")
public class CamelApplication {
    private static final String DEFAULT_XML_ROUTE_CONFIG_FILES = "classpath:/routes/*.xml";
    public static void main(String[] args) {
        System.out.println("********************* inside the project ******************");
    	SpringApplication app = new SpringApplication(CamelApplication.class);
        app.setDefaultProperties(getDefaultProperties());
        app.run(args);
    }
    private static Properties getDefaultProperties() {
        Properties props = new Properties();
        props.setProperty("camel.springboot.main-run-controller", "true");
        return props;
    }
}

我的 build.gradle 如下:

plugins {
    id 'groovy'
    id 'java'
    id "org.springframework.boot" version "2.2.6.RELEASE"
}

group 'com.firas'
version '1.0-SNAPSHOT'

apply plugin: "org.springframework.boot"
apply plugin: "java"

repositories {
    mavenCentral()
}

dependencies {
    compile "org.apache.camel:camel-bom:2.25.0"
    compile "org.apache.camel:camel-core:2.25.0"
    compile "org.apache.camel:camel-spring-boot-dependencies:2.25.0"
    compile "org.apache.camel:camel-spring-boot-starter:2.25.0"
    compile "org.springframework:spring-aop:4.0.4.RELEASE"
    compile "org.springframework:spring-context:4.0.4.RELEASE"
    compile "org.springframework:spring-tx:4.0.4.RELEASE"
    compile "org.apache.camel.springboot:camel-timer-starter:2.25.0"
    compile "org.springframework.boot:spring-boot-starter-tomcat:2.2.6.RELEASE"
    
    
    testCompile group: 'junit', name: 'junit', version: '4.13'
}
springBoot {
    mainClassName = 'CamelApplication'
}
bootJar {
    mainClassName = 'CamelApplication'
    manifest {
        attributes 'Start-Class': 'CamelApplication'
    }
}

下面是我的部署程序集配置的屏幕截图:

在此处输入图像描述

有关如何修复它的任何提示或指导?我在日志中没有看到任何错误,所以我在这里盲目飞行。

标签: eclipsespring-boottomcat9

解决方案


推荐阅读