春豆入口沒有經驗。豆入豆注入
<beans:bean id="ModeService"
class="<path>Service">
<beans:property name="Mode" value="true"/>
</beans:bean>
<beans:bean id="Filter"
class="<path>.RequestFilter">
<custom-filter position="FIRST" />
</beans:bean>
如何將ModeService bean注入Filter bean?在Spring THX @William
好吧,我有注射於是有:
<beans:bean id="maintenanceModeService"
class="<path>.MaintenanceService">
<beans:property name="maintenanceMode" value="true"/>
</beans:bean>
<beans:bean id="maintenanceFilter"
class="<path>.MaintenanceRequestFilter">
<custom-filter position="FIRST" />
<beans:property name="modeService" ref="maintenanceModeService"/>
</beans:bean>
在MaintenanceService,我已經追加二傳手/ getter方法調用變量:
boolean maintenanceMode;
public void setMaintenanceMode(boolean mode)
{
this.maintenanceMode = mode;
}
public boolean getMaintenanceMode()
{
return maintenanceMode;
}
和追加二傳手/吸氣到MaintenanceRequestFilter:
boolean modeService;
public void setModeService(MaintenanceService maintenanceMode)
{
this.modeService = maintenanceMode;
}
public MaintenanceService getMaintenanceMode()
{
return modeService;
}
,然後調用modeServ冰的doFilter()
但不便錯了...
我解決我的問題,這只是疏忽:) – Pilot 2012-07-12 10:44:08