IoC : Inversion of Control
spring是通過(guò)依賴注入(Dependency Injection )實(shí)現(xiàn)的IoC
IoC容器
* 必須將被管理的對(duì)象定義到spring配置文件中
* 必須定義constructor或者setter方法,讓spring將對(duì)象注入進(jìn)去
AOP : Aspect Oriented Programming
spring帶來(lái)了一種編程方式,面向切面的編程。
AOP是一個(gè)概念
在一個(gè)程序中分離一個(gè)功能,這種功能的實(shí)現(xiàn)是與程序不相關(guān)的類。
同時(shí)能夠使很多類共享這個(gè)功能。
關(guān)注是他的主要點(diǎn),要關(guān)注某個(gè)功能,要關(guān)注切入點(diǎn)。
實(shí)現(xiàn)AOP有2點(diǎn):
1、Pointcut(切入點(diǎn))是一個(gè)范圍---表達(dá)式
2、Advice(具體實(shí)現(xiàn))功能放到那個(gè)方法
spring對(duì)hibernate的支持
注入SessionFactory到spring配置文件中
<Bean id="SessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactory">
<property nema="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</Bean>
只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。 | ||
![]() |
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問(wèn)
管理
|
||