Java 问题:从Spring应用程序中构建可部署在Azure上的JAR
我有一个在本地工作的Spring Boot REST应用程序,我想将其部署到Microsoft Azure。为此,我需要创建一个可执行jar。我正在使用Spring工具套件(Eclipse)。导出时,我选择“将所需库提取到生成的JAR”选项,每当我在cmd中运行JAR时,我都会遇到以下错误:Java 问题:从Spring应用程序中构建可部署在Azure上的JAR,java,spring,azure,gradle,jar,Java,Spring,Azure,Gradle,Jar,我有一个在本地工作的Spring Boot REST应用程序,我想将其部署到Microsoft Azure。为此,我需要创建一个可执行jar。我正在使用Spring工具套件(Eclipse)。导出时,我选择“将所需库提取到生成的JAR”选项,每当我在cmd中运行JAR时,我都会遇到以下错误: Caused by: java.lang.IllegalArgumentException: No auto configuration classes found in META-INF/spring.
Caused by: java.lang.IllegalArgumentException: No auto configuration classes
found in META-INF/spring.factories. If you are using a custom packaging, make
sure that file is correct.
如果选择“将所需库打包到生成的JAR中”选项,则会出现以下错误(等待一段时间后):
当我选择将所需库复制到JAR文件旁边的子文件夹中时,JAR在本地运行良好,但当JAR和lib文件托管在Azure上时,web应用程序将不会重新发送(放置在我的wwwroot目录中,其中有一个指向JAR的web.config文件)
我的问题:我需要选择这三个选项中的哪一个,以及如何让这个JAR在Azure上运行?我觉得这只是我的build.gradle的一个问题,你可以在这里看到:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
springBoot {
mainClass = "src.main.java.hello.Application"
executable = true
}
repositories {
mavenCentral()
}
jar {
baseName = 'gs-rest-service'
version = '0.1.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('org.springframework:spring-jdbc')
}
我真的很感激任何帮助,因为我一直无法在其他地方找到答案
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
springBoot {
mainClass = "src.main.java.hello.Application"
executable = true
}
repositories {
mavenCentral()
}
jar {
baseName = 'gs-rest-service'
version = '0.1.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile('org.springframework.boot:spring-boot-starter-test')
compile('org.springframework:spring-jdbc')
}