티스토리 뷰

"/"로 접근시 특정 html 페이지로 리다이렉트를 시키고 싶었습니다. 

기존 소스 

1
2
3
4
5
6
7
8
@Controller
public class WelcomeController {
 
    @GetMapping("/")
    public String index() {
        return new "redirect:/apidocs/index.html";
    }
}
cs

예전엔 별 문제가 없었는데 spring boot 2.x에서는 에러가 납니다. 


아래처러 고치니 정상 작동합니다. 

1
2
3
4
5
6
7
8
@Controller
public class WelcomeController {
 
    @GetMapping("/")
    public RedirectView index() {
        return new RedirectView("/apidocs/index.html");
    }
}
cs


오늘은 삽질 끝~~~ 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/02   »
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
글 보관함