隨筆-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 閱讀(328) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 进贤县| 建阳市| 溆浦县| 南康市| 湖州市| 朝阳区| 莆田市| 新津县| 海丰县| 九龙县| 从化市| 绵竹市| 红河县| 安远县| 历史| 正镶白旗| 手游| 湖南省| 莱阳市| 广西| 鄢陵县| 新巴尔虎左旗| 鲁甸县| 封丘县| 甘谷县| 抚州市| 全州县| 潞城市| 福鼎市| 汉阴县| 成安县| 威海市| 阆中市| 嘉义市| 霍州市| 隆尧县| 灵武市| 若尔盖县| 饶平县| 姚安县| 济源市|