1.
@Controller
@SpringBootApplication
public class ProductApplication {
@RequestMapping("/")
String index() {
return "redirect:index.html";
}
public static void main(String[] args) {
SpringApplication.run(ProductApplication.class, args);
}
}
2.使用thymeleaf
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
@Controller
@SpringBootApplication
public class ProductApplication {
@RequestMapping("/")
String index() {
return "templates";
}
public static void main(String[] args) {
SpringApplication.run(ProductApplication.class, args);
}
}
网友评论