上一页 1 2 3 4 5 6 ··· 14 下一页
摘要: 自定义拦截器步骤 1 创建拦截器类实现HandlerInterceptor @Controller public class TargetController { @RequestMapping("/target") public ModelAndView show() { System.out.p 阅读全文
posted @ 2022-11-28 18:46 Cuora 阅读(179) 评论(0) 推荐(0)
摘要: 本周继续学习Spring的知识,通过Spring完成了一个mis系统的增删改查 阅读全文
posted @ 2022-11-28 12:54 Cuora 阅读(28) 评论(0) 推荐(0)
摘要: 1 导入spring-jdbc和spring-tx坐标 2 创建数据库表和实体 3 创建JdbcTemplate对象 4 执行数据库操作 阅读全文
posted @ 2022-11-27 17:21 Cuora 阅读(22) 评论(0) 推荐(0)
摘要: 1 文件上传客户端三要素 * 表单项type = "file" * 表单的提交方式时post * 表单的enctype属性时多部分表单形式,即enctype = "multipart/form-data" 2 单文件上传步骤 1 导入fileupload和io坐标 <dependency> <gro 阅读全文
posted @ 2022-11-26 21:13 Cuora 阅读(70) 评论(0) 推荐(0)
摘要: SpringMVC的相关组件 前端控制器:DispatcherServlet 处理器映射器:HandlerMapping 处理器适配器:HandlerAdapter 处理器:Handler 视图解析器:ViewResolver 视图:View SpringMVC的注解和配置 请求映射注解:@Requ 阅读全文
posted @ 2022-11-25 18:23 Cuora 阅读(11) 评论(0) 推荐(0)
摘要: 1 导入SpringMVC相关坐标 2 配置SpringMVC核心控制器DispatcherServlet 3 创建Controller类和视图页面 4 使用注解配置Controller 5 配置SpringMVC核心文件spring-mvc.xml 6 客户端发起请求测试 阅读全文
posted @ 2022-11-25 12:03 Cuora 阅读(21) 评论(0) 推荐(0)
摘要: 1 导入Spring集成Junit的坐标 2 使用@RunWith注解替换原来的运行期 3 使用@ContextConfiguration指定配置文件或配置类 4 使用@Autowired注入需要测试的对象 5 创建测试方法进行测试 package test; import java.sql.SQL 阅读全文
posted @ 2022-11-24 17:49 Cuora 阅读(34) 评论(0) 推荐(0)
摘要: @Configuration 用于指定当前类是一个Spring配置类,创建容器时会在该类上加载注解 @ComponentScan 用于指定Spring在初始化容器时要扫描的包 @Bean 在方法上使用,标注将该方法的返回值存储到Spring容器中 @PropertySource 用于加载proper 阅读全文
posted @ 2022-11-24 11:25 Cuora 阅读(19) 评论(0) 推荐(0)
摘要: @Component 在类上用于实例化Bean @Controller 在web层的类上用于实例化Bean @Service 在service层的类上用于实例化Bean @Repository 在dao层的类上用于实例化Bean @Autowired 在字段上用于根据类型依赖注入 @Qualifie 阅读全文
posted @ 2022-11-24 11:14 Cuora 阅读(21) 评论(0) 推荐(0)
摘要: //dataSource.javapackage spring_ioc_anno; import java.beans.PropertyVetoException; import java.sql.Connection; import java.util.ResourceBundle; import 阅读全文
posted @ 2022-11-23 20:32 Cuora 阅读(44) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 14 下一页