0
我在Spring Boot(v1.4.1)应用程序中使用Spring Restdocs(v1.1.2)。在弹簧启动应用程序中访问spring-restdocs生成的内容
在摇篮构建文件的jar任务,我复制生成的输出到公共/文档:
jar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'public/docs'
}
}
,我在生成JAR看到文档中
BOOT-INF/classes/public/docs/api-guide.html
但是,当我运行JAR时,似乎无法解决/ docs,/ public/docs等中的api-guide.html。
有人可以请解释我在做什么错吗?
谢谢!
--John
buildscript {
ext {
springBootVersion = '1.4.1.RELEASE'
}
}
plugins {
id "org.asciidoctor.convert" version "1.5.3"
}
apply plugin: 'groovy'
apply plugin: 'spring-boot'
ext {
snippetsDir = file('build/generated-snippets')
springRestdocsVersion = '1.1.2.RELEASE'
}
test {
outputs.dir snippetsDir
}
asciidoctor {
attributes 'snippets': snippetsDir
inputs.dir snippetsDir
dependsOn test
}
jar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'public/docs'
}
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-data-rest')
testCompile("org.springframework.restdocs:spring-restdocs-mockmvc:${springRestdocsVersion}")
}
==================================== =========================
这里的应用程序配置:
@SpringBootApplication
@EnableJpaRepositories
@EnableScheduling
class Application {
static void main(String[] args) {
SpringApplication.run Application, args
}
}
和测试配置:
@RunWith(SpringJUnit4ClassRunner)
@SpringApplicationConfiguration(classes = Application)
class ApplicationTests {
...
}
你能提供一些关于你如何配置你的启动应用的更多信息吗? –
感谢您的关注Andy。这是一个非常标准的Spring引导的Gradle构建,但是我已经在上面包含了更多的build.gradle。这是你想到的吗? –
我对您的应用程序的配置更感兴趣。例如,如果您使用了'@ EnableWebMvc',它将禁用Boot的默认支持来提供静态资源。 –