when i use springboot upgrade it from 2.3.3 to 2.7.16 , this request is fail 404 For example: http://localhost:8080/init.do , http://localhost:8080/init http://localhost:8080/test

application.properties:

spring.mvc.view.prefix=/views/
spring.mvc.view.suffix=.jsp
logging.level.root=info
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {

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

    @Resource
    private MultipartConfigElement multipartConfigElement;
    @Resource
    private DispatcherServlet dispatcherServlet;

    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.setUseRegisteredSuffixPatternMatch(true);
    }


    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        ServletRegistrationBean<DispatcherServlet> servletServletRegistrationBean =
                new ServletRegistrationBean<>(dispatcherServlet);
        servletServletRegistrationBean.addUrlMappings("*.do");
        servletServletRegistrationBean.setMultipartConfig(multipartConfigElement);
        servletServletRegistrationBean.setLoadOnStartup(1);
        return servletServletRegistrationBean;
    }
}

use this config, is is work in version 2.3.3 , but fail in 2.7.16

POM:

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.glassfish.web</groupId>
            <artifactId>jakarta.servlet.jsp.jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

Because there are .do or .json requests in my legacy project, I would like to handle them without making modifications to any other code. And when i do not use MvcConfiguration, it can work. For example , http://localhost:8080/init, http://localhost:8080/test but request with .do can not work, ie. http://localhost:8080/init.do What can I do, Thanks !

Comment From: bclozel

Thanks for getting in touch, but it feels like this is a question that would be better suited to StackOverflow. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.

In this case, you should attempt to migrate to 2.4 first, then 2.5, etc. and provide a minimal sample in your StackOverflow question. Note that jakarta dependencies are not compatible with Spring Boot 2.7.