![](https://img-blog.csdnimg.cn/20201026194612152.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
Spring
业务逻辑层框架:需求
半三鱼
难的清醒,长时间糊涂。
展开
-
Spring 基于XML或注解的声明式事务控制
Spring 基于XML或注解的声明式事务控制基于XML的声明式事务控制声明式事务控制的代码准备Spring 基于xml的声明式事务控制的步骤基于注解的声明式事务控制基于XML的声明式事务控制声明式事务控制的代码准备包的结构dao包package com.itheima.dao;import com.itheima.domain.Account;/** * 账户的持久层接口 */public interface IAccountDao { /** * 根据Id查原创 2020-12-15 22:07:20 · 185 阅读 · 0 评论 -
Spring中事务控制的一组API
Spring中事务控制的一组API事务控制Spring中事务控制( Spring中事务控制的API)PlateformTransactionManager接口TransationDefinition :事务的定义信息对象TransationStatus:此接口提供的是事务具体的运行状态事务控制JavaEE 体系进行分层开发,事务控制和处理处于业务层 如果想要在业务层进行事务控制有两种方法:1.原创 2020-12-15 17:22:50 · 139 阅读 · 0 评论 -
spring 基于xml的AOP实现事务控制
**将事务控制类(TransactionManager)看成是一个通知类 **1.导入spring 开启AOP的约束(在bean.xml)<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop=原创 2020-12-15 12:45:10 · 97 阅读 · 0 评论 -
Spring基于注解的aop配置
Spring基于注解的aop配置1.配置xml<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"原创 2020-12-14 16:46:27 · 94 阅读 · 0 评论 -
Spring 基于XML的AOP配置步骤
Spring 基于XML的AOP配置步骤AOP中的一些术语Spring 基于xml的AOP中配置步骤AOP中的一些术语连接点(Joinpoint):是指被拦截到的那些点,在spring 这些点指的是方法,spring 只支持方法类型的连接点。既准备被增强的方法。切入点(Pointcut):所谓切入点是指我们对哪些JoinPoint进行拦截的定义(指的是被增强的方法,如果该方法没有增强代码那么他就不是切入点,只是连接点)通知/增强(Advice):拦截到 切入点之后要做的事情就是通知(原创 2020-12-14 15:51:25 · 184 阅读 · 0 评论 -
Spring整合JUnit
Spring整合JUnit我们都知道程序的入口,是main()方法。在JUnit测试中集成了一个main()方法,该方法会判断当前测试类中哪些方法有@Test注解,junit就会让有Test注解的方法执行,但是junit不会管我们是否采用了spring框架,也根本不知道我们是否使用了spring框架,所以在使用JUnit 的init()方法将“读取配置文件并创建核心容器”这部分共同代码提到一起的时候,Junit不会为我们读取配置文件和创建核心 容器。问题来了,我们如何让Junit知道我们使用了sprin原创 2020-11-21 00:57:57 · 729 阅读 · 0 评论 -
Spring新注解Configuration、ComponentScan、Bean 、Import 、PropertySource
Spring新注解Spring新注解@Configuration@ComponentScan/ComponentScans@BeanSpring新注解@Configuration表明当前类是一个配置类。他的作用和bean,xml一样@ComponentScan/ComponentScans-------- 作用:用于Spring 在创建容器时要扫描的包--------属性value/basePackages:两者的功能都是一样的 <context:component-scan base-p原创 2020-11-12 01:03:54 · 396 阅读 · 0 评论 -
Spring基于注解的IOC入门
Spring基于注解的IOC入门模拟表现层,业务层,持久层的类基于注解的IOC配置Maven工程 pom.xml导入spring依赖配置bean..xml文件在com.itheima包下的任意类 使用注解@Component运行结果模拟表现层,业务层,持久层的类基于注解的IOC配置Maven工程 pom.xml导入spring依赖<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.or原创 2020-11-03 21:57:28 · 139 阅读 · 0 评论 -
Spring之ApplicationContext的三个实现类、ApplicationContext和BeanFactory的区别
ApplicationContext的三个实现类、ApplicationContext和BeanFactory的区别ApplicationContext的三个实现类ClassPathXmlApplicationContextFileSystemXmlApplicationContextAnnotationConfigApplicationContextApplicationContext和BeanFactoryApplicationContext的三个实现类ClassPathXmlApplication原创 2020-11-02 01:03:01 · 571 阅读 · 0 评论 -
Spring基于xml之IOC的环境搭建和 入门案例
Spring基于xml之IOC的环境搭建和 入门创建Maven工程(Create New Project)pom.xml导入依赖在类路径下创建xml文件,导入约束入门案例创建三个类和两个接口,因为创建的是Maven工程而不是web工程因此Client模拟表现层,Service模拟业务层,Account模拟持久层(表现层调用业务层,业务层再调用持久层)1.创建Client.java2.创建IAccountService 接口和实现类AccountServiceImpl3.创建IAccountDao接口和实现类原创 2020-10-31 18:11:07 · 100 阅读 · 0 评论 -
Spring入门的前期介绍
Spring入门的前期Spring的介绍概述spring的优势Spring的体系结构1.方便解耦,简化开发Spring的介绍概述 Spring是分层的JavaSE/EE应用full-stack(全栈)轻量级开源框架,以IOC(Inverse Of Control:反转控制)和AOP(Aspect Oriented Programming:面向切面编程)为内核,提供了展示层SpringMVC和持久层Spring JDBC以及业务层事务管理等众多的企业级应原创 2020-10-28 02:08:27 · 70 阅读 · 0 评论