Vin*_*nay 0 embedded-jetty spring-boot
我正在尝试用 Jetty 替换 Tomcat,作为我的嵌入式 servlet 容器。然后需要使用EmbeddedServletContainerCustomizer()来配置将80端口的请求重定向到443端口(HTTPS)。但是我一开始就被这些gradlew构建错误困住了:
RedirectHttpToHttpsOnJettyConfig.java:7: 错误:包 org.springframework.boot.context.embedded 不存在
导入 org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
RedirectHttpToHttpsOnJettyConfig.java:8: 错误:包 org.springframework.boot.context.embedded 不存在
导入 org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
RedirectHttpToHttpsOnJettyConfig.java:9: 错误:包 org.springframework.boot.context.embedded.jetty 不存在
导入 org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
RedirectHttpToHttpsOnJettyConfig.java:10: 错误:包 org.springframework.boot.context.embedded.jetty 不存在
导入 org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
...
这是我的 build.gradle:
buildscript {
ext {
springBootVersion = '2.0.0.BUILD-SNAPSHOT'
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
ext['thymeleaf.version'] = '3.0.9.RELEASE'
war {
baseName = 'reachout'
version = '0.0.2'
}
compileJava {
options.warnings = true
options.debug = true
options.compilerArgs += ["-Xlint:deprecation"]
}
sourceSets {
main {
java {
exclude '**/RedirectHttpToHttpsOnTomcatConfig.java'
}
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/snapshot" }
maven { url "https://repo.spring.io/milestone" }
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-thymeleaf')
compile("org.springframework.boot:spring-boot-starter-web") {
exclude module: "spring-boot-starter-tomcat"
}
compile("org.springframework.boot:spring-boot-starter-jetty")
compile('org.springframework.boot:spring-boot-starter-actuator')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.thymeleaf.extras:thymeleaf-extras-springsecurity4')
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("org.springframework.boot:spring-boot-starter-data-jpa")
compile("com.h2database:h2")
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
Run Code Online (Sandbox Code Playgroud)
任何指针都非常感谢。
| 归档时间: |
|
| 查看次数: |
12972 次 |
| 最近记录: |