나는, here에서 스프링 부팅 샘플 웹 정전기 프로젝트를 실행 한 치어스프링 부트에서 정적 html을 제공하려면 어떻게해야합니까?
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
이 변경을했다 그리고 같은 static
폴더에서 중복 된 페이지 index2.html를 제공하기 위해이 클래스를 추가 위치 :
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class Rester {
@RequestMapping(value = "/rand", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
private RandomObj jsonEndpoint() {
return new RandomObj();
}
@RequestMapping(value = "/tw")
public String somePg() {
return "index2";
}
}
json으로 URL이 잘 작동하지만 내가 로컬 호스트에 액세스하려고 할 때 : 8080/TW 내가 빈 페이지를 얻고, 콘솔에서이 오류 :
2017-02-22 15:37:22.076 ERROR 21494 --- [nio-8080-exec-9] o.s.boot.web.support.ErrorPageFilter : Cannot forward to error page for request [/tw] as the response has already been committed. As a result, the response may have the wrong status code. If your application is running on WebSphere Application Server you may be able to resolve this problem by setting com.ibm.ws.webcontainer.invokeFlushAfterService to false
내가 잘못하고 있니? 도와 주시면 감사하겠습니다.
당신은 정말로 바람둥이 의존성을 필요로하지 않습니다, 봄 초보 웹 & thymeleaf 그것을해야합니다. –