Создаю Spring-приложение со следующей структурой
и деплою его на сервере томкэт
После деплоя открывается index страница, но не могу попасть к контролллеру по url:
localhost:8080/test
код контроллера:
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class Tst {
@RequestMapping(value = "/test", method= RequestMethod.GET)
public void getTest(){
System.err.println("========IN REST MESSAGE OKEY==========");
System.err.println("========IN REST MESSAGE OKEY==========");
System.err.println("========IN REST MESSAGE OKEY==========");
System.err.println("========IN REST MESSAGE OKEY==========");
}
}
web.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<display-name>GameShop</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:WEB-INF/applicationContext.xml</param-value>
</context-param>
applicationContext.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:task="http://www.springframework.org/schema/task"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocaion="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.3.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.3.xsd
http://www.springframework.org/schema/security"
default-autowire="byName">
<context:annotation-config/>
</beans>
и 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">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:WEB-INF/applicationContext.xml</param-value>
</context-param>
</web-app>
Подскажите что я делаю не так?