[轉(zhuǎn)]Spring加載resource時(shí)classpath*:與classpath:的區(qū)別
摘要: Spring可以通過(guò)指定classpath*:與classpath:前綴加路徑的方式從classpath加載文件,如bean的定義文件.classpath*:的出現(xiàn)是為了從多個(gè)jar文件中加載相同的文件.classpath:只能加載找到的第一個(gè)文件.
閱讀全文
struts2 + spring, 使用session範(fàn)圍的Bean的配置事項(xiàng)
摘要: 異常信息:
Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running out
閱讀全文
spring注解入門(mén)(轉(zhuǎn))
摘要:
的base-package屬性指定了需要掃描的類(lèi)包,類(lèi)包及其遞歸子包中所有的類(lèi)都會(huì)被處理。
還允許定義過(guò)濾器將基包下的某些類(lèi)納入或排除。Spring支持以下4種類(lèi)型的過(guò)濾方式:
* 過(guò)濾器類(lèi)型 表達(dá)式范例 說(shuō)明
* 注解 org.example.SomeAnnotation 將所有使用SomeAnnotation注解的類(lèi)過(guò)濾出來(lái)
* 類(lèi)名指定 org.example.SomeClass 過(guò)濾指定的類(lèi)
* 正則表達(dá)式 com\.kedacom\.spring\.annotation\.web\..* 通過(guò)正則表達(dá)式過(guò)濾一些類(lèi)
* AspectJ表達(dá)式 org.example..*Service+ 通過(guò)AspectJ表達(dá)式過(guò)濾一些類(lèi)
閱讀全文
用Spring的JdbcTemplate實(shí)現(xiàn)分頁(yè)功能
摘要: Oracle數(shù)據(jù)庫(kù),使用偽列ROWNUM來(lái)實(shí)現(xiàn)分頁(yè)。
閱讀全文
轉(zhuǎn):用Spring快速開(kāi)發(fā)jms應(yīng)用(JBOSS服務(wù)器)
摘要: 異步進(jìn)程通信是面向服務(wù)架構(gòu)(SOA)一個(gè)重要的組成部分,因?yàn)槠髽I(yè)里很多系統(tǒng)通信,特別是與外部組織間的通信,實(shí)質(zhì)上都是異步的。Java消息服務(wù)(JMS)是用于編寫(xiě)使用異步消息傳遞的JEE應(yīng)用程序的API。傳統(tǒng)的使用JMS API進(jìn)行消息傳遞的實(shí)現(xiàn)包括多個(gè)步驟,例如JNDI查詢(xún)隊(duì)列連接工廠和Queue資源,在實(shí)際發(fā)送和接收消息前創(chuàng)建一個(gè)JMS會(huì)話。
閱讀全文
在Servlet中調(diào)用spring中定義的Bean
摘要: WebApplicationContextUtils.getRequiredWebApplicationContext(getServletContext()).getBean("bookService");
閱讀全文