相关疑难解决方法(0)

如何将简单的Spring Boot(使用Gradle构建系统)部署到Apache Tomcat(真实服务器,而不是嵌入式服务器)?

我遵循这个教程:http ://spring.io/guides/gs/rest-service/
这是我的项目结构: 在此输入图像描述

build.gradle

buildscript{
    repositories{
        mavenCentral()
    }
    dependencies{
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.3.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'spring-boot'

jar{
    baseName = 'gs-rest-service'
    version = '0.1.0'
}

repositories{
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies{
    compile("org.springframework.boot:spring-boot-starter-web") 
    testCompile("junit:junit")
}
task wrapper(type: Wrapper){
    gradleVersion = '2.3'
}
Run Code Online (Sandbox Code Playgroud)



Application.java

package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}
Run Code Online (Sandbox Code Playgroud)



Greeting.java

package hello;

public …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc gradle spring-boot

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

gradle ×1

java ×1

spring ×1

spring-boot ×1

spring-mvc ×1