- SpringMvcConfig配置类
// SpringMvcConfigpackage com.itheima.config;import org.springframework.context.annotation.ComponentScan;import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.EnableWebMvc;// Spring配置类@Configuration// 扫描包@ComponentScan("com.itheima.controller")// 万能工具注解@EnableWebMvcpublic class SpringMvcConfig {}// ServletConfigpackage com.itheima.config;import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;// 注意:继承于AbstractAnnotationConfigDispatcherServletInitializerpublic class ServletConfig extends AbstractAnnotationConfigDispatcherServletInitializer { // 设置SpringConfig protected Class<?>[] getRootConfigClasses() { return new Class[]{SpringConfig.class}; } // 设置SpringMvcConfig protected Class<?>[] getServletConfigClasses() { return new Class[]{SpringMvcConfig.class}; } // 设置路径锁定"/"即可 protected String[] getServletMappings() { return new String[]{"/"}; }}
- 数据库对应实体类创建
// Bookpackage com.itheima.domain;public class Book { private Integer id; private String type; private String name; private String description; @Override public String toString() { return "Book{" + "id=" + id + ", type='" + type + '\'' + ", name='" + name + '\'' + ", description='" + description + '\'' + '}'; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; }}
经验总结扩展阅读
-
2023年5月定亲黄道吉日 2023年5月哪天适合定亲
-
-
-
2023年1月4日制作房梁黄道吉日 2023年农历腊月十三制作房梁吉日
-
-
-
-
有一句俗话:“早起的鸟儿有虫吃。|早睡早起的时间,早起的人更容易获取成功机会
-
健康周谈|冬天是脑梗高发季,该如何度过?医生:做好4件事,或能安稳过冬
-
8月,4大星座财运大涨,横财正财偏财齐聚满堂,富贵满堂
-
-
-
-
-
-
-
越南|中国男性和越南男性有啥区别?听听越南姑娘是怎么说的
-
裸妆|看来看去,浓妆艳抹不算啥,还是裸妆最百搭,关键实用又简单
-
-