锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产曰批免费观看久久久,国产在线视频资源,欧美激情视频播放http://www.aygfsteel.com/fisher/category/17937.html澶╄鍋ワ紝鍚涘瓙浠ヨ嚜寮轟笉鎭傚湴鍔垮潳錛屽悰瀛愪互鍘氬痙杞界墿銆?/description>zh-cnWed, 28 Feb 2007 03:43:55 GMTWed, 28 Feb 2007 03:43:55 GMT60鐢ˋcegi涓轟綘鐨凷pring搴旂敤鍔犳妸閿侊紒(杞?http://www.aygfsteel.com/fisher/articles/92379.htmlFisherFisherMon, 08 Jan 2007 07:14:00 GMThttp://www.aygfsteel.com/fisher/articles/92379.htmlhttp://www.aygfsteel.com/fisher/comments/92379.htmlhttp://www.aygfsteel.com/fisher/articles/92379.html#Feedback0http://www.aygfsteel.com/fisher/comments/commentRss/92379.htmlhttp://www.aygfsteel.com/fisher/services/trackbacks/92379.html
[綆浠媇
瀵逛簬涓涓吀鍨嬬殑Web搴旂敤錛屽畬鍠勭殑璁よ瘉鍜屾巿鏉冩満鍒舵槸蹇呬笉鍙皯鐨勶紝鍦⊿pringFramework涓紝Juergen Hoeller鎻愪緵鐨勮寖渚婮PetStore緇欎簡(jiǎn)涓浜涜繖鏂歸潰鐨勪粙緇嶏紝浣嗚繕榪滆繙涓嶅錛孉cegi鏄竴涓笓闂ㄤ負(fù)SpringFramework鎻愪緵瀹夊叏鏈哄埗鐨?欏圭洰錛屽叏縐頒負(fù)Acegi Security System for Spring錛屽綋鍓嶇増鏈負(fù)0.5.1錛屽氨鍏剁洰鍓嶆彁渚涚殑鍔熻兘錛屽簲璇ュ彲浠ユ弧瓚崇粷澶у鏁板簲鐢ㄧ殑闇姹傘?br />
鏈枃鐨勪富瑕佺洰鐨勬槸甯屾湜鑳藉璇存槑濡備綍鍦ㄥ熀浜嶴pring鏋勬灦鐨刉eb搴旂敤涓嬌鐢ˋcegi錛岃屼笉鏄緇嗕粙緇嶅叾涓殑姣忎釜鎺ュ彛銆佹瘡涓被銆傛敞鎰忥紝鍗充嬌瀵瑰凡緇忓瓨鍦ㄧ殑Spring搴旂敤錛岄氳繃涓嬮潰浠嬬粛鐨勬楠わ紝涔熷彲浠ラ┈涓婁韓鍙楀埌Acegi鎻愪緵鐨勮璇佸拰鎺堟潈銆?/font>

[鍩虹宸ヤ綔]

鍦ㄤ綘鐨刉eb搴旂敤鐨刲ib涓坊鍔燗cegi涓嬭澆鍖呬腑鐨刟cegi-security.jar

[web.xml]
瀹炵幇璁よ瘉鍜屾巿鏉冪殑鏈甯哥敤鐨勬柟娉曟槸閫氳繃filter錛孉cegi浜︽槸濡傛錛岄氬父Acegi闇瑕佸湪web.xml娣誨姞浠ヤ笅5涓猣ilter:

<filter>
聽(tīng) <filter-name>Acegi Channel Processing Filter</filter-name>
聽(tīng) <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
聽(tīng) <init-param>
聽(tīng)聽(tīng)聽(tīng) <param-name>targetClass</param-name>
聽(tīng)聽(tīng)聽(tīng) <param-value>net.sf.acegisecurity.securechannel.ChannelProcessingFilter</param-value>
聽(tīng) </init-param>
</filter>
<filter>
聽(tīng) <filter-name>Acegi Authentication Processing Filter</filter-name>
聽(tīng) <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
聽(tīng) <init-param>
聽(tīng)聽(tīng)聽(tīng) <param-name>targetClass</param-name>
聽(tīng)聽(tīng)聽(tīng) <param-value>net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter</param-value>
聽(tīng) </init-param>
</filter>
<filter>
聽(tīng) <filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
聽(tīng) <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
聽(tīng) <init-param>
聽(tīng)聽(tīng)聽(tīng) <param-name>targetClass</param-name>
聽(tīng)聽(tīng)聽(tīng) <param-value>net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter</param-value>
聽(tīng) </init-param>
</filter>
<filter>
聽(tīng) <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
聽(tīng) <filter-class>net.sf.acegisecurity.ui.AutoIntegrationFilter</filter-class>
</filter>
<filter>
聽(tīng) <filter-name>Acegi HTTP Request Security Filter</filter-name>
聽(tīng) <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
聽(tīng) <init-param>
聽(tīng)聽(tīng)聽(tīng) <param-name>targetClass</param-name>
聽(tīng)聽(tīng)聽(tīng) <param-value>net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter</param-value>
聽(tīng) </init-param>
</filter>

鏈鍏堝紩璧瘋糠鎯戠殑鏄痭et.sf.acegisecurity.util.FilterToBeanProxy錛孉cegi鑷繁鐨勬枃妗d笂瑙i噴鏄細(xì) 鈥淲hat聽(tīng) FilterToBeanProxy does is delegate the Filter's methods through to a bean which is obtained from the
Spring application context. This enables the bean to benefit from the Spring application context lifecycle support and configuration flexibility.鈥濓紝濡傚笇鏈涙繁絀剁殑璇濓紝鍘葷湅鐪嬫簮浠g爜搴旇涓嶉毦鐞嗚В銆?br />
鍐嶄笅鏉ュ氨鏄坊鍔爁ilter-mapping浜?jiǎn)锛?xì)
<filter-mapping>
聽(tīng) <filter-name>Acegi Channel Processing Filter</filter-name>
聽(tīng) <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
聽(tīng) <filter-name>Acegi Authentication Processing Filter</filter-name>
聽(tīng) <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
聽(tīng) <filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
聽(tīng) <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
聽(tīng) <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
聽(tīng) <url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
聽(tīng) <filter-name>Acegi HTTP Request Security Filter</filter-name>
聽(tīng) <url-pattern>/*</url-pattern>
</filter-mapping>

榪欓噷錛岄渶瑕佹敞鎰忎互涓嬩袱鐐癸細(xì)
1) 榪欏嚑涓猣ilter鐨勯『搴忔槸涓嶈兘鏇存敼鐨勶紝欏哄簭涓嶅灝嗘棤娉曟甯稿伐浣滐紱
2) 濡傛灉浣犵殑搴旂敤涓嶉渶瑕佸畨鍏ㄤ紶杈擄紝濡俬ttps錛屽垯灝?Acegi Channel Processing Filter"鐩稿叧鍐呭娉ㄩ噴鎺夊嵆鍙紱
3) 濡傛灉浣犵殑搴旂敤涓嶉渶瑕丼pring鎻愪緵鐨勮繙紼嬭闂満鍒訛紝濡侶essian and Burlap錛屽皢"Acegi HTTP BASIC Authorization
Filter"鐩稿叧鍐呭娉ㄩ噴鎺夊嵆鍙?br />
[applicationContext.xml]
鎺ヤ笅鏉ュ氨鏄娣誨姞applicationContext.xml涓殑鍐呭浜?jiǎn)锛屼粠鍒氭墠FilterToBeanFactory鐨勮В閲婂彲浠ョ湅鍑猴紝鐪熸鐨刦ilter閮?br />鍦⊿pring鐨刟pplicationContext涓鐞嗭細(xì)

1) 棣栧厛錛屼綘鐨勬暟鎹簱涓繀欏誨叿鏈変繚瀛樼敤鎴峰悕鍜屽瘑鐮佺殑table錛孉cegi瑕佹眰table鐨剆chema蹇呴』濡備笅錛?br />
CREATE TABLE users (
聽(tīng)聽(tīng) 聽(tīng)username VARCHAR(50) NOT NULL PRIMARY KEY,
聽(tīng)聽(tīng) 聽(tīng)password VARCHAR(50) NOT NULL,
聽(tīng)聽(tīng) 聽(tīng)enabled BIT NOT NULL
);
CREATE TABLE authorities (
聽(tīng)聽(tīng) 聽(tīng)username VARCHAR(50) NOT NULL,
聽(tīng)聽(tīng) 聽(tīng)authority VARCHAR(50) NOT NULL
);
CREATE UNIQUE INDEX ix_auth_username ON authorities ( username, authority );
ALTER TABLE authorities ADD CONSTRAINT fk_authorities_users foreign key (username) REFERENCES users
(username);

2) 娣誨姞璁塊棶浣犵殑鏁版嵁搴撶殑datasource鍜孉cegi鐨刯dbcDao錛屽涓嬶細(xì)

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
聽(tīng) <property name="driverClassName"><value>${jdbc.driverClassName}</value></property>
聽(tīng) <property name="url"><value>${jdbc.url}</value></property>
聽(tīng) <property name="username"><value>${jdbc.username}</value></property>
聽(tīng) <property name="password"><value>${jdbc.password}</value></property>
</bean>
<bean id="jdbcDaoImpl" class="net.sf.acegisecurity.providers.dao.jdbc.JdbcDaoImpl">
聽(tīng) <property name="dataSource"><ref bean="dataSource"/></property>
</bean>


3) 娣誨姞DaoAuthenticationProvider:

<bean id="daoAuthenticationProvider" class="net.sf.acegisecurity.providers.dao.DaoAuthenticationProvider">
聽(tīng) <property name="authenticationDao"><ref bean="authenticationDao"/></property>
聽(tīng) <property name="userCache"><ref bean="userCache"/></property>
</bean>

<bean id="userCache" class="net.sf.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
聽(tīng) <property name="minutesToIdle"><value>5</value></property>
</bean>


濡傛灉浣犻渶瑕佸瀵嗙爜鍔犲瘑錛屽垯鍦╠aoAuthenticationProvider涓姞鍏ワ細(xì)<property name="passwordEncoder"><ref
bean="passwordEncoder"/></property>錛孉cegi鎻愪緵浜?jiǎn)鍑牽U嶅姞瀵嗘柟娉曪紝璇︾粏鎯呭喌鍙湅鍖?br />net.sf.acegisecurity.providers.encoding

4) 娣誨姞authenticationManager:

<bean id="authenticationManager" class="net.sf.acegisecurity.providers.ProviderManager">
聽(tīng) <property name="providers">
聽(tīng)聽(tīng)聽(tīng) <list>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <ref bean="daoAuthenticationProvider"/>
聽(tīng)聽(tīng)聽(tīng) </list>
聽(tīng)聽(tīng) </property>
</bean>


5) 娣誨姞accessDecisionManager:

<bean id="accessDecisionManager" class="net.sf.acegisecurity.vote.AffirmativeBased">
聽(tīng) <property name="allowIfAllAbstainDecisions">
聽(tīng)聽(tīng)聽(tīng) <value>false</value>
聽(tīng) </property>
聽(tīng) <property name="decisionVoters">
聽(tīng)聽(tīng)聽(tīng) <list><ref bean="roleVoter"/></list>
聽(tīng) </property>
</bean>
<bean id="roleVoter" class="net.sf.acegisecurity.vote.RoleVoter"/>

6) 娣誨姞authenticationProcessingFilterEntryPoint:

<bean id="authenticationProcessingFilterEntryPoint"
class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilterEntryPoint">
聽(tīng) <property name="loginFormUrl"><value>/acegilogin.jsp</value></property>
聽(tīng) <property name="forceHttps"><value>false</value></property>
</bean>


鍏朵腑acegilogin.jsp鏄櫥闄嗛〉闈紝涓涓渶綆鍗曠殑鐧誨綍欏甸潰濡備笅錛?br />
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %>
<%@ page import="net.sf.acegisecurity.ui.AbstractProcessingFilter" %>
<%@ page import="net.sf.acegisecurity.AuthenticationException" %>
<html>
聽(tīng) <head>
聽(tīng)聽(tīng)聽(tīng) <title>Login</title>
聽(tīng) </head>

聽(tīng) <body>
聽(tīng)聽(tīng)聽(tīng) <h1>Login</h1>
聽(tīng)聽(tīng)聽(tīng) <form action="<c:url value='j_acegi_security_check'/>" method="POST">
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <table>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <tr><td>User:</td><td><input type='text' name='j_username'></td></tr>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <tr><td>Password:</td><td><input type='password' name='j_password'></td></tr>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <tr><td colspan='2'><input name="submit" type="submit"></td></tr>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <tr><td colspan='2'><input name="reset" type="reset"></td></tr>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) </table>
聽(tīng)聽(tīng)聽(tīng) </form>
聽(tīng) </body>
</html>


7) 娣誨姞filterInvocationInterceptor:

<bean id="filterInvocationInterceptor"
class="net.sf.acegisecurity.intercept.web.FilterSecurityInterceptor">
聽(tīng) <property name="authenticationManager">
聽(tīng)聽(tīng)聽(tīng) <ref bean="authenticationManager"/>
聽(tīng) </property>
聽(tīng) <property name="accessDecisionManager">
聽(tīng)聽(tīng)聽(tīng) <ref bean="accessDecisionManager"/>
聽(tīng) </property>
聽(tīng) <property name="objectDefinitionSource">
聽(tīng)聽(tīng)聽(tīng) <value>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) \A/sec/administrator.*\Z=ROLE_SUPERVISOR
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) \A/sec/user.*\Z=ROLE_TELLER
聽(tīng)聽(tīng)聽(tīng) </value>
聽(tīng) </property>
</bean>


榪欓噷璇鋒敞鎰忥紝瑕乷bjectDefinitionSource涓畾涔夊摢浜涢〉闈㈤渶瑕佹潈闄愯闂紝闇瑕佹牴鎹嚜宸辯殑搴旂敤闇姹傝繘琛屼慨鏀癸紝鎴戜笂闈㈢粰鍑?br />鐨勫畾涔夌殑鎰忔濇槸榪欐牱鐨勶細(xì)
聽(tīng)a. CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON鎰忔濇槸鍦ㄦ瘮杈冭姹傝礬寰勬椂鍏ㄩ儴杞崲涓哄皬鍐?br />聽(tīng)b. \A/sec/administrator.*\Z=ROLE_SUPERVISOR鎰忔濇槸鍙湁鏉冮檺涓篟OLE_SUPERVISOR鎵嶈兘璁塊棶/sec/administrator*鐨勯〉闈?br />聽(tīng)c. \A/sec/user.*\Z=ROLE_TELLER鎰忔濇槸鍙湁鏉冮檺涓篟OLE_TELLER鐨勭敤鎴鋒墠鑳借闂?sec/user*鐨勯〉闈?br />
8) 娣誨姞securityEnforcementFilter:

<bean id="securityEnforcementFilter" class="net.sf.acegisecurity.intercept.web.SecurityEnforcementFilter">
聽(tīng) <property name="filterSecurityInterceptor">
聽(tīng)聽(tīng)聽(tīng) <ref bean="filterInvocationInterceptor"/>
聽(tīng) </property>
聽(tīng) <property name="authenticationEntryPoint">
聽(tīng)聽(tīng)聽(tīng) <ref bean="authenticationProcessingFilterEntryPoint"/>
聽(tīng) </property>
</bean>

9) 娣誨姞authenticationProcessingFilter:

<bean id="authenticationProcessingFilter"
class="net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter">
聽(tīng) <property name="authenticationManager">
聽(tīng)聽(tīng)聽(tīng) <ref bean="authenticationManager"/>
聽(tīng) </property>
聽(tīng) <property name="authenticationFailureUrl">
聽(tīng)聽(tīng)聽(tīng) <value>/loginerror.jsp</value>
聽(tīng) </property>
聽(tīng) <property name="defaultTargetUrl">
聽(tīng)聽(tīng)聽(tīng) <value>/</value>
聽(tīng) </property>
聽(tīng) <property name="filterProcessesUrl">
聽(tīng)聽(tīng)聽(tīng) <value>/j_acegi_security_check</value>
聽(tīng) </property>
</bean>

鍏朵腑authenticationFailureUrl鏄璇佸け璐ョ殑欏甸潰銆?br />
10) 濡傛灉闇瑕佷竴浜涢〉闈㈤氳繃瀹夊叏閫氶亾鐨勮瘽錛屾坊鍔犱笅闈㈢殑閰嶇疆:

<bean id="channelProcessingFilter" class="net.sf.acegisecurity.securechannel.ChannelProcessingFilter">
聽(tīng) <property name="channelDecisionManager">
聽(tīng)聽(tīng)聽(tīng) <ref bean="channelDecisionManager"/>
聽(tīng) </property>
聽(tīng) <property name="filterInvocationDefinitionSource">
聽(tīng)聽(tīng)聽(tīng) <value>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) \A/sec/administrator.*\Z=REQUIRES_SECURE_CHANNEL
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) \A/acegilogin.jsp.*\Z=REQUIRES_SECURE_CHANNEL
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) \A/j_acegi_security_check.*\Z=REQUIRES_SECURE_CHANNEL
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) \A.*\Z=REQUIRES_INSECURE_CHANNEL
聽(tīng)聽(tīng)聽(tīng) </value>
聽(tīng) </property>
</bean>

<bean id="channelDecisionManager" class="net.sf.acegisecurity.securechannel.ChannelDecisionManagerImpl">
聽(tīng) <property name="channelProcessors">
聽(tīng)聽(tīng)聽(tīng) <list>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <ref bean="secureChannelProcessor"/>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng) <ref bean="insecureChannelProcessor"/>
聽(tīng)聽(tīng)聽(tīng) </list>
聽(tīng) </property>
</bean>
<bean id="secureChannelProcessor" class="net.sf.acegisecurity.securechannel.SecureChannelProcessor"/>
<bean id="insecureChannelProcessor" class="net.sf.acegisecurity.securechannel.InsecureChannelProcessor"/>


[緙哄皯浜?jiǎn)浠涔堬紵]
Acegi鐩墠鎻愪緵浜?jiǎn)涓たU?secure object"錛屽垎鍒欏甸潰鍜屾柟娉曡繘琛屽畨鍏ㄨ璇佺鐞嗭紝鎴戣繖閲屼粙緇嶇殑鍙槸鍒╃敤
FilterSecurityInterceptor瀵硅闂〉闈㈢殑鏉冮檺鎺у埗錛岄櫎姝や箣澶栵紝Acegi榪樻彁渚涗簡(jiǎn)鍙﹀涓涓狪nterceptor鈥斺?br />MethodSecurityInterceptor錛屽畠緇撳悎runAsManager鍙疄鐜板瀵硅薄涓殑鏂規(guī)硶鐨勬潈闄愭帶鍒訛紝浣跨敤鏂規(guī)硶鍙弬鐪婣cegi鑷甫鐨勬枃妗?br />鍜宑ontact鑼冧緥銆?br />
[鏈鍚庤璇寸殑]
鏈潵浠ヤ負(fù)鍙槸璇存槑濡備綍浣跨敤Acegi鑰屽凡錛屽簲璇ラ潪甯哥畝鍗曪紝浣嗙湡姝e啓璧鋒潵鎵嶅彂鐜版兂瑕佹潯鐞嗘竻妤氱殑鐞嗛『鎵鏈夐渶瑕佺殑bean榪樻槸寰?br />鍥伴毦鐨勶紝浣嗘効鎴戞病鏈夐仐婕忓お澶氫笢瑗匡紝濡傛灉鎴戠殑鏂囩珷鏈変粈涔堥仐婕忔垨閿欒鐨勮瘽錛岃繕璇峰弬鐪婣cegi鑷甫鐨剄uick-start鑼冧緥錛屼絾璇?br />娉ㄦ剰錛岃繖涓寖渚嬫槸涓嶈兘鐩存帴鎷挎潵鐢ㄧ殑銆?/font>


Fisher 2007-01-08 15:14 鍙戣〃璇勮
]]>
Spring涓瑼pplicationContext鍔犺澆鏈哄埗http://www.aygfsteel.com/fisher/articles/90130.htmlFisherFisherTue, 26 Dec 2006 07:48:00 GMThttp://www.aygfsteel.com/fisher/articles/90130.htmlhttp://www.aygfsteel.com/fisher/comments/90130.htmlhttp://www.aygfsteel.com/fisher/articles/90130.html#Feedback0http://www.aygfsteel.com/fisher/comments/commentRss/90130.htmlhttp://www.aygfsteel.com/fisher/services/trackbacks/90130.htmlSpring涓瑼pplicationContext鍔犺澆鏈哄埗銆?
聽(tīng)聽(tīng)聽(tīng)聽(tīng)鍔犺澆鍣ㄧ洰鍓嶆湁涓ょ閫夋嫨錛欳ontextLoaderListener鍜孋ontextLoaderServlet銆?
聽(tīng)聽(tīng)聽(tīng)聽(tīng)榪欎袱鑰呭湪鍔熻兘涓婂畬鍏ㄧ瓑鍚岋紝鍙槸涓涓槸鍩轟簬Servlet2.3鐗堟湰涓柊寮曞叆鐨凩istener鎺ュ彛瀹炵幇錛岃屽彟涓涓熀浜嶴ervlet鎺ュ彛瀹炵幇銆傚紑鍙戜腑鍙牴鎹洰鏍嘩eb瀹瑰櫒鐨勫疄闄呮儏鍐佃繘琛岄夋嫨銆?

閰嶇疆闈炲父綆鍗曪紝鍦╳eb.xml涓鍔狅細(xì)
<listener>
聽(tīng)聽(tīng)<listener-class>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)org.springframework.web.context.ContextLoaderListener
聽(tīng)聽(tīng)</listener-class>
</listener>
鎴栵細(xì)
<servlet>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)<servlet-name>context</servlet-name>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)<servlet-class>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)聽(tīng)org.springframework.web.context.ContextLoaderServlet
聽(tīng)聽(tīng)聽(tīng)聽(tīng)</servlet-class>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)<load-on-startup>1</load-on-startup>
</servlet>

閫氳繃浠ヤ笂閰嶇疆錛學(xué)eb瀹瑰櫒浼?xì)鑷姩鍔犺?WEB-INF/applicationContext.xml鍒濆鍖?
ApplicationContext瀹炰緥錛屽鏋滈渶瑕佹寚瀹氶厤緗枃浠朵綅緗紝鍙氳繃context-param鍔犱互鎸囧畾錛?
<context-param>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)<param-name>contextConfigLocation</param-name>
聽(tīng)聽(tīng)聽(tīng)聽(tīng)<param-value>/WEB-INF/myApplicationContext.xml</param-value>
</context-param>

閰嶇疆瀹屾垚涔嬪悗錛屽嵆鍙氳繃
聽(tīng)WebApplicationContextUtils.getWebApplicationContext鏂規(guī)硶鍦╓eb搴旂敤涓幏鍙朅pplicationContext寮曠敤銆?

濡傦細(xì)ApplicationContext聽(tīng)ctx=WebApplicationContextUtils.getWebApplicationContext();
聽(tīng)聽(tīng)聽(tīng)聽(tīng)LoginAction聽(tīng)action=(LoginAction)ctx.getBean("action");


杞澆錛?a >http://hi.baidu.com/jgs80/blog/item/307a40a794a7ad95d1435896.html

Fisher 2006-12-26 15:48 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 寻乌县| 阳东县| 水城县| 永济市| 泾阳县| 宁都县| 加查县| 葫芦岛市| 三门峡市| 湘潭市| 大悟县| 恩平市| 漯河市| 勐海县| 安顺市| 织金县| 樟树市| 花垣县| 鄂伦春自治旗| 邻水| 宜丰县| 隆林| 贞丰县| 辽源市| 游戏| 鄢陵县| 疏勒县| 南京市| 十堰市| 屯留县| 莒南县| 芒康县| 康保县| 克东县| 内黄县| 清镇市| 沙田区| 南皮县| 盐山县| 麻阳| 阿鲁科尔沁旗|