大战熟女丰满人妻av-荡女精品导航-岛国aaaa级午夜福利片-岛国av动作片在线观看-岛国av无码免费无禁网站-岛国大片激情做爰视频

專注Java教育14年 全國咨詢/投訴熱線:400-8080-105
動力節(jié)點LOGO圖
始于2009,口口相傳的Java黃埔軍校
首頁 hot資訊 Spring配置文件模板

Spring配置文件模板

更新時間:2021-06-16 11:45:41 來源:動力節(jié)點 瀏覽1123次

模板:

<?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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
    <bean id="moocAppctx" class="imooc_spring.test.aware.MoocApplicationContext"
        init-method="hhhh">
    </bean>
</beans>

更全面的一個模板,20170327添加

<?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/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
    <bean id="moocAppctx" class="imooc_spring.test.aware.MoocApplicationContext"
        init-method="hhhh">
    </bean>
    <!-- 引入db.properties -->
    <context:property-placeholder location="classpath:db.properties" />
    <!-- 配置C3P0數據源 -->
    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="jdbcUrl" value="${jdbc.url}"></property>
        <property name="driverClass" value="${jdbc.driverName}"></property>
        <property name="user" value="${jdbc.username}"></property>
        <property name="password" value="${jdbc.pwd}"></property>
    </bean>
    <!-- 配置 Spring 的 org.springframework.jdbc.core.JdbcTemplate -->
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
        <property name="dataSource" ref="dataSource"></property>
    </bean>
    <bean id="moocBeanNameAware" class="imooc_spring.test.aware.MoocBeanNameAware"></bean>
    <!-- 測試 SpEL: 可以為屬性進行動態(tài)的賦值(了解) -->
    <bean id="girl" class="com.helloworld.User">
        <property name="userName" value="周迅"></property>
    </bean>
    <!-- <bean id="boy" class="com.helloworld.User" init-method="init" destroy-method="destroy">
        <property name="userName" value="高勝遠"></property> <property name="wifeName"
        value="#{girl.userName}"></property> </bean> -->
    <bean id="girl2" class="com.helloworld.User2">
        <property name="userName" value="Talor Swift"></property>
    </bean>
    <!-- autowired測試,自動裝配測試 -->
    <bean id="people" class="test.spring.autowired.Person" scope="prototype"
        autowire="byName">
        <property name="name" value="小明"></property>
        <!-- <property name="cat" ref="cat222"></property> -->
        <!-- <property name="cat" ref="cat1"></property> -->
    </bean>
    <bean id="cat" class="test.spring.autowired.Cat" scope="prototype">
        <property name="name" value="波斯貓"></property>
    </bean>
    <!-- <bean id="cat222" class="test.spring.autowired.Cat"> <property name="name"
        value="我是小喵喵"></property> </bean> -->
    <bean id="people2" class="test.spring.autowired.Person" scope="prototype"
        autowire="byName">
        <property name="name" value="小明"></property>
        <property name="cat" ref="cat222"></property>
    </bean>
    <bean id="cat222" class="test.spring.autowired.Cat" scope="prototype">
        <property name="name" value="波斯貓"></property>
    </bean>
    <!--context:component-scan 指定 掃描的包 -->
    <!--可以通過 resource-pattern 指定掃描的資源, resource-pattern="myrepository/*.class"
        的含義: 只掃描 base-package 對應包下的 目錄為 myrepository 的所有java Bean -->
    <!-- <context:component-scan base-package="imooc_spring.test.anotation"
        resource-pattern="myrepository/*.class"></context:component-scan> -->
    <!-- context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"
        子節(jié)點指定排除哪些注解 context:include-filter type="annotation" 需要結合context:component-scan
        標簽的 use-default-filters="false"來使用 context:exclude-filter type="assignable"
        這個expression指的是自己寫的類,意思排除哪些類 expression="imooc_spring.test.anotation.TestObj" -->
    <context:component-scan base-package="imooc_spring.test.anotation">
        <!-- <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Repository"
            /> -->
        <!-- <context:exclude-filter type="assignable" expression="imooc_spring.test.anotation.TestObj"
            /> -->
    </context:component-scan>
    <context:component-scan base-package="com.aop"></context:component-scan>
    <!-- aop測試,需要引入aop命名空間 -->
    <aop:aspectj-autoproxy></aop:aspectj-autoproxy>
    <!-- aop annotationType, -->
    <!-- 切點的bean -->
    <bean class="com.aop.xmltype.CalculatorImplxml" id="calImplxml"></bean>
    <!-- 切面的bean -->
    <bean class="com.aop.xmltype.MyAspectxml" id="myaspxml"></bean>
    <bean class="com.aop.xmltype.Diary" id="myDiary"></bean>
    <!-- aop xmlType,用xml的形式配置AOP前置通知 -->
    <aop:config>
        <!--aop:pointcut 其實放在這兒也可以 -->
        <!-- <aop:pointcut expression="execution (* com.aop.xmltype.CalculatorImplxml.*(..))"
            id="pointcut1" /> -->
        <!-- 配置切面和通知 ,aop:aspect標簽需要通過ref指定配置好的bean,id隨便配置或者不配置,id的值可以隨意起 -->
        <aop:aspect id="myaspxml" ref="myaspxml" order="2">
            <!-- 配置切點,即 要被記日記的對象, aop:pointcut 放在這兒也可以 ,切點不需要根對應的bean相關聯,
             只要expression指定的方法所在的類被Spring掃描得到就行,即只要所在的類配置了bean就可以 -->
            <aop:pointcut expression="execution (* com.aop.xmltype.CalculatorImplxml.*(..))"
                id="pointcut1" />
            <!-- 切面里的具體的用于記錄的方法就是一個通知,需要用通過pointcut-ref來指定具體的切點, -->
            <aop:before method="logBefore" pointcut-ref="pointcut1" />
            <aop:after method="logAfter" pointcut-ref="pointcut1" />
        </aop:aspect>
        <aop:aspect ref="myDiary" order="3">
            <!-- execution (* com.aop.*.*.*(..))  包含了 com.aop.xmltype.CalculatorImplxml.*(..)) 的這種情況  -->
            <!-- <aop:pointcut expression="execution (* com.aop.*.*.*(..))" id="allPointcut"/> -->
            <aop:pointcut expression="execution (* com.aop.xmltype.CalculatorImplxml.*(..))" id="allPointcut"/>
            <aop:before method="myEnd" pointcut-ref="allPointcut"/>
        </aop:aspect>
    </aop:config>
</beans>

所在項目:

以上就是動力節(jié)點小編介紹的"Spring配置文件模板",希望對大家有幫助,如有疑問,請在線咨詢,有專業(yè)老師隨時為您服務。

提交申請后,顧問老師會電話與您溝通安排學習

免費課程推薦 >>
技術文檔推薦 >>
主站蜘蛛池模板: 97福利影院 | 国产亚洲精品福利在线 | 亚洲综合在线观看视频 | 亚洲国产精品久久婷婷 | 大ji吧快给我别停受不了视频 | 国产在线麻豆一区二区 | 欧美一级特黄毛片免费 | 亚洲欧洲精品在线 | 鲁丝一区 | 欧美一级全部免费视频 | 黄色综合| 天天天天躁天天天天碰 | 亚洲日本人成网站在线观看 | a毛片免费| 欧美aaaaa一级毛片在线 | 夜夜躁狠狠躁日日躁2021 | 青青青在线视频人视频在线 | 欧美日韩一二三区 | 国产精品成人免费观看 | 精品哟啊呦v视频在线观看 精品哟哟国产在线观看 | 日韩手机看片 | 久久久久久亚洲精品中文字幕 | 日韩精品在线一区 | 日本操操操 | 国产91在线 | 日韩 | 欧美三区在线 | 99热这里只有精品1 99热这里只有精品18 | 婷婷夜夜躁天天躁人人躁 | 综合婷婷 | 久久久久国产精品美女毛片 | 未成人做爰视频www 我爱52avαv永久网站 | 91精品国产综合久久欧美 | 在线观看国产情趣免费视频 | 亚洲一级影片 | 久久久久免费精品国产 | 老妇毛片 | 日韩深夜 | 欧美伦理一区 | 4虎永免费最新永久免费地址 | 国产深夜福利视频观看 | 五月情视频在线观看 |