隨筆-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 閱讀(327) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 嘉峪关市| 博客| 新宁县| 辉南县| 清苑县| 鸡西市| 高雄市| 寿光市| 神木县| 白城市| 海晏县| 砚山县| 上林县| 措勤县| 望城县| 武宁县| 于田县| 治多县| 固镇县| 河西区| 汕尾市| 博野县| 壤塘县| 吴江市| 察哈| 七台河市| 东兰县| 双江| 临城县| 长丰县| 梓潼县| 阿坝| 阿拉尔市| 海门市| 锡林浩特市| 江安县| 桃源县| 高碑店市| 哈巴河县| 察雅县| 诏安县|