-1
간단한 스프링 웹 애플리케이션을 만들었습니다. @RequestMapping을 가진이 간단한 @Controller를 가지고 있지만 URL을 실행할 수 없습니다.간단한 스프링 웹 서비스에 어떤 문제가 있습니까?
http://localhost:8080/labutil/all
무엇이 잘못 되었나요?
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();
}
}
또한 http : // localhost : 8080/all을 시도 할 수 있습니까? 그것은 나에게 URL 문제처럼 보인다. – Kael53
application-context.xml 파일을 게시 해주십시오. – SachinSarawgi
컨트롤러에서/labutil을 설정하지 않습니다. @ Kael53 제안이 작동해야합니다 (URL에 앱 컨텍스트 추가) – Alfabravo