隨筆-348  評論-598  文章-0  trackbacks-0
          下面是一個Manager Service(AOP),她可以提供一些高級方法,例如聯合的刪除,或者順便發一封Email等等
          <bean id="passwordHintAction" class="com.inpoint.webapp.action.PasswordHintAction" scope="prototype">
          <property name="userManager" ref="userManager"/>
          <property name="mailEngine" ref="mailEngine"/>
          <property name="message" ref="mailMessage"/>
          </bean>
          <aop:config>
          <aop:advisor id="userManagerTx" advice-ref="userManagerTxAdvice" pointcut="execution(* ..service.UserManager.(..))" order="0"/>
          <aop:advisor id="userManagerSecurity" advice-ref="userSecurityAdvice" pointcut="execution(* *..service.UserManager.saveUser(..))" order="1"/>
          <aop:advisor id="managerTx" advice-ref="txAdvice" pointcut="execution(* ..service.*Manager.(..))" order="2"/>
          </aop:config>

          <tx:advice id="txAdvice">
          <tx:attributes>
          <tx:method name="get*" read-only="true"/>
          <tx:method name="*"/>
          </tx:attributes>
          </tx:advice>

          <tx:advice id="userManagerTxAdvice">
          <tx:attributes>
          <tx:method name="save*" rollback-for="UserExistsException"/>
          </tx:attributes>
          </tx:advice>

          <bean id="lookupManager" class="com.inpoint.service.impl.LookupManagerImpl">
          <property name="lookupDao" ref="lookupDao"/>
          </bean>
          這樣做是因為DAO只要提供CRUD操作即可,而一些高級操作不應該加到DAO里面,否則會出現一些問題。感謝Crespo的幫助!

          ---------------------------------------------------------
          專注移動開發

          Android, Windows Mobile, iPhone, J2ME, BlackBerry, Symbian
          posted on 2007-05-10 22:32 TiGERTiAN 閱讀(333) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 泸定县| 石渠县| 泾阳县| 琼海市| 襄樊市| 环江| 桦甸市| 治县。| 延长县| 台东市| 沧源| 陵川县| 舟山市| 社旗县| 普陀区| 巴林左旗| 舞钢市| 滁州市| 邯郸市| 尼勒克县| 迭部县| 新郑市| 朔州市| 安塞县| 启东市| 新晃| 东乡县| 灵台县| 漳州市| 陇西县| 阳春市| 青龙| 包头市| 樟树市| 左贡县| 天水市| 贡山| 耿马| 杭锦旗| 天气| 墨江|