I built a simple Spring Web application. I have this simple @Controller with an @RequestMapping, but when I run it I can't hit the URL:
http://localhost:8080/labutil/all
What am I doing wrong?
package com.mycompany.ion.labutil.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.nokia.ion.labutil.service.LabService;
@Controller
public class LabController {
@Autowired
private LabService labService;
@RequestMapping(value = "/all", method = RequestMethod.GET)
public String getAll() throws Exception {
List<String> list = labService.getAll();
// build fake little json formatted data
StringBuffer sb = new StringBuffer("{");
for (String s : list) {
sb.append("{ "+s+" }, ");
}
sb.append("}");
return sb.toString();
}
}