Когда я запускаю веб-приложение Spring Boot. Оно работает хорошо, но в браузере, когда я превышаю содержимое этого веб-приложения, мой jsp-файл автоматически загружается вместо отображения содержимого. .
Ниже первого приложения Spring, загружающего:
Код: Выделить всё
package com.springboot.web;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@SpringBootApplication
public class SpringBootFirstApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootFirstApplication.class, args);
}
}
Код: Выделить всё
package com.springboot.web;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class mainController {
@GetMapping("/home")
public String home() {
return "home";
}
}
Код: Выделить всё
spring.mvc.view.prefix=/views/
spring.mvc.view.suffix=.jsp
server.port=9091
Код: Выделить всё
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.1.0
com.web
springmvcboot
0.0.1-SNAPSHOT
SpringBootFirst
web project spring boot
17
org.springframework.boot
spring-boot-starter-web
org.apache.tomcat.embed
tomcat-embed-jasper
provided
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin
Код: Выделить всё
Insert title here
This is my Home Jsp
Подробнее здесь: https://stackoverflow.com/questions/763 ... -spring-bo
Мобильная версия