<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                學習完了Spring AOPAnnotation之后在再學xml方式的我覺得就很簡明易懂了。這個案例不再將一些細節性的問題再次敘述,請看案例代碼,如下所示: 1、?編寫被代理對象: ~~~ import org.springframework.stereotype.Component; import com.spring.dao.UserDao; @Component("userService") public class UserServiceImpl implements UserService{ private UserDao userDao; public void setUserDao(UserDao userDao) { this.userDao = userDao; } //在下面方法前面加邏輯 public void HelloWorld(){ System.out.println("helloworld"); } } ~~~ 2、編寫配置文件: ~~~ <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd" > <context:annotation-config/> <!-- 配置容器資源掃描的包 --> <context:component-scan base-package="com.spring" /> <!-- 將前面類寫入容器 --> <bean id="logInterceptor" class="com.spring.aop.LogInterceptor" /> <!-- 配置AOP --> <aop:config> <!-- 聲明pointcut --> <aop:pointcut expression="execution(public * com.spring.service..*.*(..))" id="servicepoint" /> <!-- 聲明切面類 --> <aop:aspect id="aspectLog" ref="logInterceptor"> <aop:before method="BeforeMethod" pointcut-ref="servicepoint"/> <aop:after-returning method="AfterMethod" pointcut-ref="servicepoint"/> <aop:around method="aroundProcced" pointcut-ref="servicepoint"/> </aop:aspect> </aop:config> </beans> ~~~ 3、編寫測試文件: ~~~ package com.spring.test; import org.junit.Test; import org.springframework.beans.factory.BeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.spring.service.UserService; public class SpringTest { @Test public void test01() { BeanFactory applicationContext = new ClassPathXmlApplicationContext( "beans.xml"); UserService user = (UserService) applicationContext.getBean("userService"); user.HelloWorld(); } } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看