Spring优点
Spring Framework
- Core Container:核心容器
- AOP:面向切面编程
- Aspects: AOP思想实现
- Data Access :数据访问
- Data Integration: 数据集成
IoC,IoC容器,Bean,DI
导入依赖
<dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.2.10.RELEASE</version></dependency>
public static void main(String[] args) {//获取IoC容器ApplicationContext act = new ClassPathXmlApplicationContext("applicationContext.xml");//获取bean对象BookService bookService = (BookService) act.getBean("bookService");BookDao bookDao = (BookDao)act.getBean("bookDao");bookService.save();}