Spring框架-one(Spring框架介绍)

01-【熟悉】Spring框架介绍

1 Spring核心
1,AOP:面向切面编程。扩展功能而不修改源代码。

UserDaoImpl
{
	void addUser(){
		//得到sqlSessionFactory
		//得到sqlSession
        //开启事务  
		//调用mybatis的api做添加
        //提交事务
		//关闭sqlSession
	}
    void deleteUser(){
		}
}

2,IOC/DI:控制反转,降低耦合度。如果调用一个类中的方法,需要new对象然后才可以调用;在spring的IoC种,可以将代码new对象的操作交给spring的配置文件来完成。

UserService userService=new UserService2Impl();
UserDao userDao=new UserDaoImpl();

UserService userService;

AServlet
	|-- UserService userService=new UserServiceImpl();
BServlet
	|-- UserService userService=new UserServiceImpl();
CSServlet
	|-- UserService userService=new UserServiceImpl();
AServlet
	|-- UserService userService;
BServlet
	|-- UserService userService;
CSServlet
	|-- UserService userService;

在这里插入图片描述

2 一站式框架
l Spring在JavaWeb三层结构中,每一层都提供了不同的解决技术。
l Web层:SpringMVC 取代 Servlet
l Service层:Spring ioc
l Dao层:Spring jdbc Template 类似于DBUtils.java
l 权限框架
l springboot 简化配置 它不是spring官方的
l springdata 简化配置 为微服务开发提供的解决方案 它不是spring官方的
l springCloud 简化配置 为微服务开发提供的解决方案 它不是spring官方的

3 spring框架图

https://spring.io/
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_44013790/article/details/88313881