我已经设法使用Spring Boot v2.0.1来实现我的小型,简单的SpringBoot / Gradle REST服务。但是,为了与我的组中的其他项目兼容,我想切换到v1.3.1 [原文如此]。但是,当我这样做时,我在以下代码中遇到了编译错误:
RADIO_PARAM_RX_MODE
如果我只是注释掉该代码,我的REST服务就不再识别其端点。有没有办法解决这个问题,例如package com.ui.usersetting.UserSettingController;
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(UserSettingControllerApplication.class);
}
}
的某些v1.3.1等价物?
答案 0 :(得分:1)
在SpringBoot 1.3中,SpringBootServletInitializer位于:org.springframework.boot.context.web.SpringBootServletInitializer
像这样更新您的代码:
package com.ui.usersetting.UserSettingController;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(UserSettingControllerApplication.class);
}
}