0

I get this: exception when to try to reach my webfunction i Spring:

PageNotFound noHandlerFound WARNING: No mapping found for HTTP request with URI in DispatcherServlet with name

In cotroller I got:

@Controller
@RequestMapping("/user/**")
@Scope("request")

and in web function:

@RequestMapping(value = "test", method = RequestMethod.GET, produces = MediaType.TEXT_PLAIN_VALUE)

In web.xml i added:

<servlet-mapping>
    <servlet-name>webApplication</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>

And after trying to reach adress:

http://localhost:8087/webApp-project/rest/user/test

I get exception:

cze 21, 2016 10:12:00 AM org.springframework.web.servlet.PageNotFound noHandlerFound
WARNING: No mapping found for HTTP request with URI [/webApp-project/rest/user/test] in DispatcherServlet with name 'webApp'

Problem was solved by adding:

<beans:bean class="com.capgemini.webApp.project.process.engine.authentication.UserRest" name="/rest/*"></beans:bean>

To config files. Please could anybody tell me why it's solved the problem? I got annotation driven configuration.

Now I want to secure page with Spring Security, and I got problems with it, maybe it's caused because of this bean definition?

Iwnow
  • 143
  • 2
  • 5
  • 12

1 Answers1

0

By default driven registers RequestMappingHandlerMapping which is used for resolving mappings from @RequestMapping annotations. But it seems it is not registered by default and BeanNameUrlHandlerMapping is registered instead. Try to register RequestMappingHandlerMapping handler manualy and then you should look where did you put annotationd-driven. Is it in application context or in web application context.

eWizard
  • 91
  • 2