我可以将Spring Boot(2.1.1.RELEASE)部署到App Engine,并可以打入/并收到问候。问题出在我将Googles Pub Sub库包含到Gradle构建文件中时。当我部署时,击中/最终出现在403中,所以不太确定发生了什么。也许幕后有某种依赖性问题?我的build.gradle是这个
buildscript {
ext.kotlin_version = '1.3.10'
ext.springBootVersion = '2.1.1.RELEASE'
ext.appEngineVersion = '2.0.0-rc3'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
classpath "org.springframework.boot:spring-boot-gradle-plugin:$springBootVersion"
classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.0.0-rc3'
}
}
repositories {
maven {
url 'https://maven-central.storage.googleapis.com'
}
jcenter()
mavenCentral()
}
apply plugin: 'kotlin'
apply plugin: 'kotlin-spring'
apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: "com.google.cloud.tools.appengine"
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
repositories {
jcenter()
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'com.google.appengine:appengine-api-1.0-sdk:+'
implementation "org.springframework.cloud:spring-cloud-gcp-starter-pubsub:+"
implementation "org.springframework.integration:spring-integration-core"
implementation 'javax.servlet:javax.servlet-api:3.1.0'
testImplementation 'com.google.appengine:appengine-testing:+'
testImplementation 'com.google.appengine:appengine-api-stubs:+'
testImplementation 'com.google.appengine:appengine-tools-sdk:+'
}
configurations.all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
exclude group: 'org.slf4j', module: 'jul-to-slf4j'
}
appengine {
deploy {
stopPreviousVersion = true
promote = true
projectId = "GCLOUD_CONFIG"
version = "GCLOUD_CONFIG"
}
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
freeCompilerArgs = ["-Xjsr305=strict"]
jvmTarget = "1.8"
}
}
即使我直接添加Google的库而不是使用Spring Boot的包装器,此问题仍然存在。我可以提供App Engine实例的启动日志,但是目前看不到任何明显的内容。
使用org.springframework.boot:spring-boot-starter-web而不是gcp-starter是在做错什么吗?弹簧靴中只能使用一个启动器吗?