Я получаю сообщение об ошибке: DispatcherServlet — Completed 404 Not Found. Мой проект упакован в виде jar, а jsps расположены в src/main/resources/META-INF/resources/jsp.
В моем application.properties указано:
spring.mvc.view.prefix=/META-INF/resources/jsp/ spring.mvc.view.suffix=.jsp
Я расширил свой jar-файл с помощью декомпилятора Java, и jsps присутствует в /META-INF/resources/jsp.
Я попробовал установить путь просмотра из файла конфигурации, но не помогло.
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view. InternalResourceViewResolver;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addResourceHandlers (ResourceHandlerRegistry registry) {
registry.addResourceHandler("/META-INF/resources/jsp/**");
.addResourceLocations("classpath:/META-INF/resources/jsp/", ".jsp");
}
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver resolver new Internal ResourceViewResolver();
resolver.setPrefix("/META-INF/resources/jsp/");
resolver.setSuffix(".jsp");
return resolver;
}}
Подробнее здесь: https://stackoverflow.com/questions/782 ... boot-3-2-4