上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页
摘要: 目的: 1) Spring管理SqlSessionFactory 2) Spring管理Mapper代理对象, 在Service层注入Mapper 3) 基于Spring的AOP, 进行事务的控制 1、搭建环境, 导入依赖 spring的jar: spring-context spring-test 阅读全文
posted @ 2020-06-13 16:01 64Byte 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 基于xml 1、环境搭建,添加需要引入的依赖 spring-aop(spring-context, 把aop加载类), spring-aspects <!-- 导入了context,会自动导入先关依赖,包括spring-aop --> <dependency> <groupId>org.spring 阅读全文
posted @ 2020-06-13 14:28 64Byte 阅读(311) 评论(0) 推荐(0) 编辑
摘要: junit之前的写法: //在Before中注入service类 private IUserService userService; @Before public void setUp() throws Exception { //使用xml的方式 ApplicationContext applic 阅读全文
posted @ 2020-06-13 13:46 64Byte 阅读(147) 评论(0) 推荐(0) 编辑
摘要: 基于xml的web开发 目的: Spring容器的创建在Tomcat启动的时候,自动创建, 并且把Spring容器保存到Application域 问题:Servlet对象无法交给Spring管理, Servlet由Tomcat创建管理, Servlet依赖Service层的类, 无法使用Spring 阅读全文
posted @ 2020-06-13 13:25 64Byte 阅读(668) 评论(0) 推荐(0) 编辑
摘要: 什么是AOP AOP是Spring提供的关键特性之一。AOP即面向切面编程,是OOP编程的有效补充。使用AOP技术,可以将一些系统性相关的编程工作,独立提取出来,独立实现,然后通过切面切入进系统。从而避免了在业务逻辑的代码中混入很多的系统相关的逻辑——比如权限管理,事物管理,日志记录等等。这些系统性 阅读全文
posted @ 2020-06-11 20:55 64Byte 阅读(160) 评论(0) 推荐(0) 编辑
摘要: User实体类: public class User { private String uid;//id主键 private String loginname;//登录名 private String loginpass;//登录密码 private String email;//邮箱 privat 阅读全文
posted @ 2020-06-10 20:29 64Byte 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 去除applicationContext.xml实现简单的spring,把bean交给spring容器管理,获取属性的注入 定义一个配置类: @Configuration 用于指定当前类是一个 spring 配置类,当创建容器时会从该类上加载注解。获取容器时需要使用AnnotationApplica 阅读全文
posted @ 2020-06-10 20:21 64Byte 阅读(493) 评论(0) 推荐(0) 编辑
摘要: 半注解半xml配置的开发方式 把<bean> 属性注入<property>,使用注解方式的替换 替换bean的注解: @Component, 标记在类上, 表示把这个类,交给Spring管理, 除dao,service,web层之外的类 @Repository 用于注册DAO(持久层 ) @Serv 阅读全文
posted @ 2020-06-10 20:08 64Byte 阅读(163) 评论(0) 推荐(0) 编辑
摘要: SpringToolSuite.exe介绍 spring Tool Suite是一个基于Eclipse IDE开发环境中的用于开发Spring应用程序的工具,提供了开箱即用的环境用于实现、调试和部署你的Spring应用,包括为关键的服务器和云计算、Git、Maven、AspectJ和最新的Eclip 阅读全文
posted @ 2020-06-10 19:42 64Byte 阅读(263) 评论(0) 推荐(0) 编辑
摘要: 一、bean的名字 使用id属性 推荐使用 <bean id="stu1" class="spring02.entity.Student"> <property name="id" value="1001" /> </bean> 使用name <bean name="stu1" class="spr 阅读全文
posted @ 2020-06-09 20:16 64Byte 阅读(181) 评论(0) 推荐(0) 编辑
上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 20 下一页