zoukankan      html  css  js  c++  java
  • 记录下配置

    <?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"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    https://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    https://www.springframework.org/schema/context/spring-context.xsd
    http://www.springframework.org/schema/tx
    https://www.springframework.org/schema/tx/spring-tx.xsd
    http://www.springframework.org/schema/aop
    https://www.springframework.org/schema/aop/spring-aop.xsd
    http://www.springframework.org/schema/mvc
    https://www.springframework.org/schema/mvc/spring-mvc.xsd">
    静态
    <mvc:default-servlet-handler/>
    <!--其他就走其他咯-->
    <mvc:annotation-driven/>
    扫描位置 加上这句 use-default-filters="false" 就只包含我要包含的了 那还不如我指定下一级

    <context:component-scan base-package="com.itheima.controller  >
    </context:component-scan>
    <!--加载配置文件-->
    <context:property-placeholder location="classpath:*.properties"/>
    <!--扫描包-->
    <context:component-scan base-package="com.itheima">
    排除mvc的bean
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

    <!--数据源-->

    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    <property name="driverClassName" value="${jdbc.driver}"/>
    <property name="url" value="${jdbc.url}"/>
    <property name="username" value="${jdbc.username}"/>
    <property name="password" value="${jdbc.password}"/>
    </bean>
    数据库相关

    <bean class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="typeAliasesPackage" value="com.itheima.domain"/>
    </bean>
    dao层的东西
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="com.itheima.dao"/>
    </bean>

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
    </bean>

    <tx:annotation-driven/>
    <!--扫描加载所有的控制类类-->

    <!--<mvc:resources mapping="/img/**" location="/img/"/>-->




    <!--
    如果是自己写的bean,用注解
    如果是第三方的bean,用配置文件
    -->

    </beans>
  • 相关阅读:
    Android code wiki
    Android 屏蔽ScrollView滑动操作
    Android PorterDuff.Mode
    微信小程序开发——小程序分享转发
    支付宝小程序开发之与微信小程序不同的地方
    微信小程序快速移植支付宝小程序
    微信小程序开发——小程序API获取用户位置及异常流处理完整示例
    微信小程序开发——开发者工具中素材管理功能使用的注意事项
    js数组排序实用方法集锦
    chrome谷歌浏览器常用快捷键搜集整理
  • 原文地址:https://www.cnblogs.com/KingAndPig/p/13822597.html
Copyright © 2011-2022 走看看