• ssm(Spring+Spring mvc+mybatis)Spring配置文件——applicationContext.xml


    <?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:p="http://www.springframework.org/schema/p"
        xmlns:context="http://www.springframework.org/schema/context"
        xsi:schemaLocation="http://www.springframework.org/schema/beans
            http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
            http://www.springframework.org/schema/context
            http://www.springframework.org/schema/context/spring-context-3.1.xsd
        ">
    
        <!-- 配置数据源 -->
        <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
            <property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
            <property name="url" value="jdbc:mysql://localhost:3306/testdb"></property>
            <property name="username" value="root"></property>
            <property name="password" value="123"></property>
        </bean>
    
        <!-- 配置数据库连接 -->
        <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
            <property name="dataSource" ref="dataSource"></property>
            <!-- 指定mybatis的配置文件 -->
            <property name="configLocation" value="classpath:mybatis-config.xml"></property>
            <!-- 指定实体类的包 -->
            <property name="typeAliasesPackage" value="org.entity"></property>
        </bean>
        <!-- 配置mapper文件的实现 -->  
        <bean id="DeptDaoMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
            <property name="mapperInterface" value="org.dao.IDeptDao"></property>
            <property name="sqlSessionFactory" ref="sqlSessionFactory"></property>
        </bean>
        <!-- 自动扫描注解的bean -->
        <context:component-scan base-package="org.service,org.dao,org.dao.impl,org.service.impl"></context:component-scan>
    </beans>
  • 相关阅读:
    FreeRTOS之源码 及 移植详解
    FreeRTOS之Tracealyzer for FreeRTOS(FreeRTOS+Trace) 详解(源码解析+移植)
    FreeRTOS之全配置项详解、裁剪(FreeRTOSConfig.h)
    linux下安装oracle中遇到的一些问题
    RedHat Enterprise Linux 6 配置Xmanager ,实现图形界面连接
    Linux ext2/ext3文件系统详解
    对固态硬盘ssd进行4k对齐
    在CentOs6.5安装jdk
    Android的API版本和名称对应关系
    Java反射机制及Method.invoke详解
  • 原文地址:https://www.cnblogs.com/a1111/p/12816079.html
Copyright © 2020-2023  润新知