spring总结

2024-10-17 版权声明 我要投稿

spring总结(精选4篇)

spring总结 篇1

1.创建一个java项目

2.导入spring的支持包

3.写一个类作为被启动的类

4.书写spring的配置文件

5.启动spring容器

6.使用spring容器创建目标类对象

7.对象进行操作 二:springIOC

1.springIOC也叫作控制反转,就是让spring容器控制目标类的创建,初始化,销毁等操作。当spring是多例的时候并不能控制对象的销毁

创建bean的三种形式:

1.利用默认的构造器(必须有默认的构造函数)

2.利用静态构造方法(利用静态代码块)

3.利用实例工厂方法 只学习了两种:

创建bean的时机:

别名:alias

Spring的创建和销毁:

*初始化:

由spring容器调用init方法

在构造函数之后执行

*销毁:

单例时,由spring容器执行销毁操作,并且对象必须为ClassPathXmlApplicationContext的时候才可以,多例的情况下spring不能销毁他

三:springDI:依赖注入:给属性赋值

1.在spring中基本数据类型包括包装类和String类型

2.基本数据类型使用set方法赋值时依据的是setxxx的方法名,所以属性名和方法名要一致。

1.利用set方法给属性赋值

构造函数给属性赋值.xml

2.注解的匹配:

1、导入命名空间

xmlns:context=“http://.itcast.spring0909.scan”> 原理

*

* 启动spring容器,加载配置文件

*

* spring容器解析到

*

*

* spring容器会在指定的包及子包中查找类上是否有@Component *

* 如果@Component注解没有写任何属性

*

@Component *

public class Person{ *

*

} *

== *

*

如果@Component(“aa”)*

@Component *

public class Person{ *

*

} *

== *

*

* 在纳入spring管理的bean的范围内查找@Resource注解

*

* 执行@Resource注解的过程

* 说明:

*

xml效率比较高,但是书写比较麻烦 *

注解效率比较低,书写比较简单

继承:

四:代理

代理比较简单,所以先不写。

1.如何使用 Java 动态代理。具体有如下四步骤:

1.通过实现 InvocationHandler 接口创建自己的调用处理器;

2.通过为 Proxy 类指定 ClassLoader 对象和一组 interface 来创建动态代理类; 3.通过反射机制获得动态代理类的构造函数,其唯一参数类型是调用处理器接口类型;

4.通过构造函数创建动态代理类实例,构造时调用处理器对象作为参数被传入。

1.SpringAOP的各个概念:

1.切面:就是流程中需要执行的类

2.通知:切面中的方法

3.切入点:就是invoke方法中方法执行的条件

4.目标对象:被代理对象

5.aop对象:代理对象

6.织入:形成代理方法的过程

7.连接点:客户端调用的方法 代理对象的方法等于通知+目标方法。

1.Spring注解用的很少,了解就可以了。五:struts2深度解析:

六:spring和hibernate整合1.切入点表达式:

/表示文件夹,.表示包 七:三大框架整合 三大框架的整合步骤:

* 新建一个工程

* 把整个工程的编码改变成utf-8

* 把整个jsp页面也改变成utf-8

* 导包

web-inf

lib

struts

hibernate

spring

db

junit

* 建三个src folder

src

存放源代码的

cn.itcast.s2sh0909.struts2.action

cn.itcast.s2sh0909.dao

cn.itcast.s2sh0909.dao.impl

cn.itcast.s2sh0909.service

cn.itcast.s2sh0909.service.impl

cn.itcast.s2sh0909.domain

config

存放所有的配置文件

struts2

hibernate

spring

applicationContext.xml

applicationContext-db.xml

...........test

存放测试类

cn.itcast.s2sh0909.test

* 在dao和service层相应的包中写接口和类

* 在applicationContext-db.xml文件中写sessionFactory

* 在cn.itcast.s2sh0909.test包中新建一个类SessionFactoryTest,目的是为了测试SessionFactory

是否配置正确

* 写spring的声明式事务处理

* 在spring的配置文件中写dao和service

* 通过savePerson方法测试声明式事务处理

spring英语作文 篇2

Entertainment subject area in spring and there merry, canyon rafting, fly so high and other titles. We play a canyon drift, where the hardships, 还r-raising, the water will cool from time to time in our body. Then, my father and I play a high-altitude flight, while it increased side spin, turn my head spin. About, and I even cardinal points are not quite sure of.

Me and my family came to the water recreation area, there are water plum pile, water single-plank bridge, water ...... I play in the water, I stood two c还ns, and felt a little flustered, afraid to move forward walk, then father, mothers encouragement, I adjusted the tempo, getting faster and faster, soon went to the shore.

Embrace spring 篇3

Spring has come quietly, we still stay in the winter of the cold. It’s time to forget the cold embrace of the spring.Spring, a season of recovery; spring, a spring season; spring, a happy season. In this beautiful season, I met the most beautiful you, let my little world bloom in this season, with its unique beauty.

Let me hold you - spring

修改后:

Spring is coming quietly, but we still stay in the cold winter. It’s time to forget the cold and embrace the warm spring.Spring is a season of revival; spring is a season of happiness. In this beautiful season, I can see the colorful flowers blooming, and enjoy the birds singing.

Spring春天英语作文 篇4

Spring春天英语作文

Spring is a delightful season.The temperatures are moderate,and the blooming trees and flowers make the city bright with colors.This is the time when we can begin to wear lighter and more brightly colored clothes and go outdoors more often.Smaller children like to bring their kites out to the spacious square.Also I enjoy going back to the village on this holiday after being in the city for the winter months.

春天是个让人欣喜的季节。气温适中,挂满绿叶的树和盛开的.花朵给城市增添了明亮的色彩。在这个时节里,我们可以穿上轻便靓丽的衣服经常出门去了。小孩子们则喜欢在广阔的天空中放风筝。在城里呆了一个冬天之后,我也喜欢回到村子里度假。

上一篇:验厂知识培训下一篇:道路交通安全工作汇报