我刚刚初始化了一个新的 Spring Boot 应用程序,并且我build.gradle有以下依赖项:
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
providedRuntime 'org.springframework.boot:spring-boot-starter-undertow'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
当我运行时./gradlew bootRun,它正在使用 Tomcat。我知道starter-web包括 Tomcat,但没有providedRuntime覆盖它吗?
我如何实际使用 undertow 来运行我的 Spring 控制器?
编辑:
我刚刚意识到我的ServletInitializer.java样子是这样的:
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(AccountServiceApplication.class);
}
}
这告诉我它正在初始化一个 servlet,我假设它是undertow基于依赖关系的,但我错了吗?
潇湘沐
相关分类