我试图用spring-boot解析一个简单的index.html文件。如果我把本地主机:8080/index.html解决,或者我得到白色错误页面,如果我不知道。解析模板“/index.html”时出错,模板可能不存在或可能无法通过任何配置的模板解析器访问
我把它贴在GIT上;这是一个非常简单的应用程序:Git Hub Link
问题似乎是模型:
表型号:
@Entity
@Table(name="applicant")
public class FormModel {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String name;
private String email;
@Size(min=2, max=200)
private String description;
public String getName() {
return name;
}
@Required
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
@Required
public void setEmail(String email) {
this.email = email;
}
public String getDescription() {
return description;
}
@Required
public void setDescription(String description) {
this.description = description;
}
}
首页控制器:
@RestController
public class Home {
@RequestMapping(value = "/", method = {RequestMethod.GET, RequestMethod.POST})
public ModelAndView index(){
ModelAndView modelAndView = new ModelAndView("/index.html");
return modelAndView;
}
}
2017-09-25
Drew1208