I want to setup Rest Controller using Spring without DispatcherServlet.
I have worked with Rest Controller with Spring MVC's dispatcher servlet but I am not sure how to setup controllers without it.
Below is the code that I tried:
@Controller
@RequestMapping("/somemapping")
public class SomeControllerImpl implements SomeController {
@Autowired
private SomeService service;
@Override
@ResponseBody
@RequestMapping(value = "/", method = RequestMethod.GET)
public List<DO> getAllDO() {
return service.getAllDO();
}
}
When I tried accessing above controller using "localhost:8080/appName/somemapping/" it gave 404 error.
Edit: I have Websphere application server. If that has something to do with my issue.
You can access the above controller's GET method using http://localhost:8080/somemapping/
Instead of giving @RequestMapping(value = "/")
, you can also give value as value=""
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.