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

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

Spring配置文件模板

更新時(shí)間:2021-06-16 11:45:41 來源:動(dòng)力節(jié)點(diǎn) 瀏覽1227次

模板:

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

更全面的一個(gè)模板,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數(shù)據(jù)源 -->
    <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: 可以為屬性進(jìn)行動(dòng)態(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="高勝遠(yuǎn)"></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測試,自動(dòng)裝配測試 -->
    <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 對應(yīng)包下的 目錄為 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é)點(diǎn)指定排除哪些注解 context:include-filter type="annotation" 需要結(jié)合context:component-scan
        標(biāo)簽的 use-default-filters="false"來使用 context:exclude-filter type="assignable"
        這個(gè)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, -->
    <!-- 切點(diǎn)的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 其實(shí)放在這兒也可以 -->
        <!-- <aop:pointcut expression="execution (* com.aop.xmltype.CalculatorImplxml.*(..))"
            id="pointcut1" /> -->
        <!-- 配置切面和通知 ,aop:aspect標(biāo)簽需要通過ref指定配置好的bean,id隨便配置或者不配置,id的值可以隨意起 -->
        <aop:aspect id="myaspxml" ref="myaspxml" order="2">
            <!-- 配置切點(diǎn),即 要被記日記的對象, aop:pointcut 放在這兒也可以 ,切點(diǎn)不需要根對應(yīng)的bean相關(guān)聯(lián),
             只要expression指定的方法所在的類被Spring掃描得到就行,即只要所在的類配置了bean就可以 -->
            <aop:pointcut expression="execution (* com.aop.xmltype.CalculatorImplxml.*(..))"
                id="pointcut1" />
            <!-- 切面里的具體的用于記錄的方法就是一個(gè)通知,需要用通過pointcut-ref來指定具體的切點(diǎn), -->
            <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>

所在項(xiàng)目:

以上就是動(dòng)力節(jié)點(diǎn)小編介紹的"Spring配置文件模板",希望對大家有幫助,如有疑問,請?jiān)诰€咨詢,有專業(yè)老師隨時(shí)為您服務(wù)。

提交申請后,顧問老師會電話與您溝通安排學(xué)習(xí)

免費(fèi)課程推薦 >>
技術(shù)文檔推薦 >>
主站蜘蛛池模板: 91久久精品国产免费一区 | 日韩免费小视频 | 国产高清一级毛片在线不卡 | 免费xxx | 亚洲精品久久久久影院 | 女人18免费毛片视频 | 亚洲在线播放 | 99国产福利视频在线观看 | 国产一区在线看 | aaaa日本| 久久午夜激情 | 亚洲综合色视频在线观看 | 热思思久久 | 俺去鲁婷婷六月色综合 | 毛片大全免费观看 | 国产精品久久久久久久久99热 | 999久久66久6只有精品 | 国产亚洲精品91 | 奇米影视奇米色777欧美 | 青青青在线视频 | 日本成本人观看免费视频fc2 | 青青国产成人久久激情911 | 狠狠丁香激情久久综合 | 精品欧美日韩一区二区三区 | 99re久久在热线播放最新地址 | 中国精品久久精品三级 | 欧美又乱又伦观看 | 思思91精品国产综合在线 | 性做久久久久久久免费看 | 亚洲欧美国产五月天综合 | 国产做爰免费视频观看 | 天天摸天天爽天天澡视频 | 久久黄色录像 | 日本久久久久中文字幕 | 香蕉视频一区二区三区 | www成人网 | 日本精品在线观看 | 福利姬在线视频国产观看 | 国产午夜精品久久久久九九 | h片在线播放免费高清 | 欧美日韩国产另类一区二区三区 |