<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [toc] spring初始化和配置bean都在容器中,也可以要求bean工廠配置一個已經存在的對象.`spring-aspects.jar`包含注解驅動的切面支持注入任何對象的能力.該支持旨在用于容器控制之外創建的對象。域對象通常不適用此類別,因為它們通常使用new運算符以編程方式創建,或者由ORM工具創建。 spring注解` @Configurable`標記一個類復合spring驅動的配置.簡單的場景下可以用來注解域對象 ~~~java package com.xyz.myapp.domain; import org.springframework.beans.factory.annotation.Configurable; @Configurable public class Account { // ... } ~~~ 等效于下面的xml配置,name,默認是class的全限定名稱,省略不寫 ~~~xml <bean class="com.xyz.myapp.domain.Account" scope="prototype"> <property name="fundsTransferService" ref="fundsTransferService"/> </bean> ~~~ 如果想指定name ~~~java package com.xyz.myapp.domain; import org.springframework.beans.factory.annotation.Configurable; @Configurable("account") public class Account { // ... } ~~~ 如果使用java注解`@Configuration`,需要再增加一個`@EnableSpringConfigured` ~~~java @Configuration @EnableSpringConfigured public class AppConfig { } ~~~ 如果喜歡使用xml ~~~xml <context:spring-configured/> ~~~ `@Configurable`注解的對象在切面配置之前創建會導致問題產生,信息會發送到debug日志,比如,spring創建域對象,使用屬性`depends-on`指定依賴切面配置 ~~~xml <bean id="myService" class="com.xzy.myapp.service.MyService" depends-on="org.springframework.beans.factory.aspectj.AnnotationBeanConfigurerAspect"> <!-- ... --> </bean> ~~~ ## Unit testing @Configurable objects 如果`@Configurable`注解的類型不是AspectJ編制的,則單元測試時不生效,你可設置mock或屬性引用對象正常測試. 如果是AspectJ編制的,則會正常運行,但是每次運行你會看到警告信息,`@Configurable`注解對象不是spring配置的 ## Working with multiple application contexts `@Configurable`的范圍是單例的,每一個類加載器對應一個切面實例, 當部署多個web應用在同一個容器時,保證各自應用從各自類路徑加載`spring-aspects.jar`(把`spring-aspects.jar` 放在目錄`'WEB-INF/lib'`).
                  <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>

                              哎呀哎呀视频在线观看