I am working on an existing code base, which is using Hibernate and Spring. I have written a Controller class, but when I am trying to see the JSON response in the browser, I get a 404 - Page Not Found exception. However, the other existing Controller classes are working in the same manner, but am not able to figure out why ? Sorry, am very new to Spring, and am sure must be missing something silly.
No mapping found for HTTP request with URI in DispatcherServlet - Context Component Scan not working
Asked
Active
Viewed 101 times
0
-
If I understand correctly you have other controllers that are working. What annotation do they use? Also Controller? I think you might have a problem with your component scan definition in the context file. – Koby Sep 02 '15 at 19:06
-
@Koby : Please see the edit above – LearningToDesign Sep 02 '15 at 19:21
-
Try defining your method as public, seems like it is defined as package-private. – Koby Sep 02 '15 at 19:31
-
@Koby : It worked. thanks so much. Please post this as answer so I can accept. – LearningToDesign Sep 03 '15 at 05:46
2 Answers
1
Seems like your controller method is defined as package-private. Change the controller method to public.

Koby
- 605
- 5
- 11
0
You seem to be using JAX-RS annotations with Spring. Apparently you can't do that. @RequestMapping
and @RestController
are the recommended annotations for what you want to do. Check the Spring guides for a good example.

Community
- 1
- 1

Manos Nikolaidis
- 21,608
- 12
- 74
- 82