spring學習需要注意的幾個點,註解與事務

2021-08-21 17:14:42 字數 810 閱讀 2211

spring註解

1.建立物件

@   component  controller service  reponsitory

暫時註解無不同

2.建立物件多例項

@service(value="user")

@scope(value="propotype")

3.物件的自動引入 autowired  或者指定引入 resource(name="   ")

4.建立物件一般用配置檔案,注入屬性一般用註解

spring 的特點

5.super調取父類的方法。繼承方法為縱向,橫向機制:動態**   jdk和cglib有無介面區別的動態**物件

1.基於註解的aop操作

2.增刪改使用upedate   查詢單個物件使用queryforobject   查詢集合使用query

3.配置連線池 c3p0

一定記得把jdbc  tx 包都匯入!!

spring的事務!! session

1.程式設計式事務管理,一般不用

2.宣告式事務管理 一般分為xml和註解,最常用註解,但必須會xml

1.配置事務  transaction

2.配置事務的增強  tx:advice

tx:attribute  

tx:method

3.配置切面 aop:config

aop:point

aop:advisor

1.配置事務

2.開啟事務註解 tx:annotation-driver

3.啟用事務的類上面加註解 @transactional

需要注意的幾個程式設計習慣

1.盡量用顯而易見的變數去訪問陣列,並在旁邊標出訪問陣列的範圍。否則很容易搞混!如 在歸併排序中,需要對陣列進行合併時,需要對同一陣列的不同段進行合併。最好用兩個變數來表示各自段的對應位置。void merge int array,int start,int middle,int end 2.關於n...

Masonry需要注意的幾個點

masonry不常用到的方法 關於mas key masonry中用來標記view的key值 a key to associate with this view 通過runtime在view中新增的屬性。在沒有定義mas key時,發生約束衝突,後台報的錯誤資訊 當定義mas key後,發生約束衝突...

HTML需要注意的幾個標籤

1.placeholder,作為提示資訊 input type text name 文字 placeholder 請輸入文字 2.required 不能為空 input type email name 郵件 placeholder 請輸入郵件 required 3.patten 正規表示式,可以搜尋...