This is a controller of springboot, I want to write a function to redirect to an html page, but it always responded with 404, and here is the code and properties. '
@Component
@Controller
@RequestMapping("/Weixin")
public class KindlePocketController {
private static final long serialVersionUID = 1L;
@Autowired
private TextBookInfoSearchService searchService;
@RequestMapping("/homepage")
public String toIndex() {
System.out.println("redirecting to homepage...");
return "index";
}
}
' application.properties '
spring.view.prefix=/WEB-INF/views/
spring.view.suffix=.html
'
the program can get into the function and output is ok. And index.html is in this path:/WEB-INF/views/index.html. Is there any else configurations ? Thanks a lot
index.htmlwhen u hithttp://...contextPath/Weixin/homepage.