【发布时间】:2015-10-15 09:35:19
【问题描述】:
当我从位于https://spring.io/guides/gs/serving-web-content/ 的 gradle 文件切换到多项目 gradle 文件设置时,我得到了一个奇怪的行为(至少对我来说:D)。
根目录下的build.gradle
//Applied to all projects.
allprojects {
apply plugin: 'eclipse'
apply plugin: 'idea'
group = 'de.test.platform'
version = '0.1'
}
subprojects {
//Currently all subprojects are also java projects. If this changes we
//need to move it into the corresponding projects
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenLocal()
mavenCentral()
}
idea {
module {
downloadSources = true
downloadJavadoc = false
}
}
}
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
}
子目录frontend中的build.gradle(因此子项目称为:frontend)
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.2.5.RELEASE")
}
}
apply plugin: 'war'
apply plugin: 'spring-boot'
jar {
baseName = 'crowdio-frontend'
version = '0.1.0'
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web")
testCompile("junit:junit")
}
当我在教程中运行 gradle bootRun 并导航到 http://localhost:8080/greeting 时,我得到一个无限循环错误。如果我将模板从 greeting.html 更改为 hello.html 并在控制器 greeting() 操作中返回 hello 而不是 greeting,我会收到 404 错误。
模板存放在project_root/frontend/src/main/resources/templates/greeting.html
【问题讨论】:
标签: spring-boot