Не работает простейшее веб приложение Spring
Помогите пожалуйста разобраться, в чем может проблема. При первоначальном создании сервера TomCat 10.0.23 автоматически открывается в браузере Index.jsp , то есть сервер работает. Проблема с закрытым портом отпадает. А при попытке попасть на http://localhost:8080/hello_world сервер выдает ошибку 404.
Контроллер
@Controller
public class HelloController {
@GetMapping("/hello_world")
public String sayHello() {
return "hello_world";
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>MvcTest</display-name>
<absolute-ordering/>
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfiguration</param-name>
<param-value>/WEB-INF/applicationContextMVC.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>
ApplicationContextMVC.xml
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns:context = "http://www.springframework.org/schema/context"
xmlns:mvc = "http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="spring" />
<mvc:annotation-driven/>
<bean id = "templateResolver" class = "org.thymeleaf.spring5.templateresolver.SpringResourceTemplateResolver">
<property name = "prefix" value = "/WEB-INF/views/"/>
<property name = "suffix" value = ".html" />
</bean>
<bean id = "templateEngine" class = "org.thymeleaf.spring5.SpringTemplateEngine" >
<property name="templateResolver" ref = "templateResolver" />
<property name = "enableSpringELCompiler" value ="true" />
</bean>
<bean class="org.thymeleaf.spring5.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine"/>
<property name="order" value="1"/>
<property name="viewNames" value="*" />
</bean>
</beans>
hello_world.html
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang = "en" >
<head>
<meta charset="ISO-8859-1">
<title >My app</title>
</head>
<body>
<p>Hello world!</p>
</body>
</html>


