Pom.xml

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  4. </dependency>

Controller

  1. @Controller
  2. public class RedirectController {
  3. @RequestMapping("/foo")
  4. void handleFoo(HttpServletResponse response) throws IOException {
  5. response.sendRedirect("http://www.baidu.com");
  6. }
  7. }