小编Sel*_*tor的帖子

如何在web.xml中配置spring-boot servlet?

我在web.xml中有一个简单的servlet配置:

<servlet>
    <servlet-name>appServlet</servlet-name>
    <servlet-class>org.atmosphere.cpr.MeteorServlet</servlet-class>
    <init-param>
        <param-name>org.atmosphere.servlet</param-name>
        <param-value>org.springframework.web.servlet.DispatcherServlet</param-value>
    </init-param>
    <init-param>
        <param-name>contextClass</param-name>
        <param-value>
            org.springframework.web.context.support.AnnotationConfigWebApplicationContext
        </param-value>
    </init-param>
    <init-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>net.org.selector.animals.config.ComponentConfiguration</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    <async-supported>true</async-supported>
</servlet>

<servlet-mapping>
    <servlet-name>appServlet</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>
Run Code Online (Sandbox Code Playgroud)

如何为SpringBootServletInitializer重写它?

java spring servlets spring-mvc spring-boot

19
推荐指数
1
解决办法
7万
查看次数

为什么"SpringSource Tool Suite"中的模板"Spring MVC Project"不能与Tomcat一起使用?

当我在SpringSource Tool中创建Spring MVC模板项目并尝试在Tomcat服务器上运行时出现此错误:

WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/test/] in DispatcherServlet with name 'appServlet'.
Run Code Online (Sandbox Code Playgroud)

这是默认值:/test/src/main/java/ru/test/test/HomeController.java

@Controller
public class HomeController {

    private static final Logger logger = LoggerFactory
            .getLogger(HomeController.class);

    /**
     * Simply selects the home view to render by returning its name.
     */
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public String home(Locale locale, Model model) {
        logger.info("Welcome home! the client locale is " + locale.toString());

        Date date = new Date();
        DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, …
Run Code Online (Sandbox Code Playgroud)

tomcat spring-mvc sts-springsourcetoolsuite

4
推荐指数
1
解决办法
8091
查看次数