ssm使用全注解实现增删改查案例——applicationContext.xml
2024-04-17 02:49:19 阅读次数:32
ssm,xml
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http:///schema/beans"
xmlns:xsi="http:///2001/XMLSchema-instance"
xmlns:p="http:///schema/p"
xmlns:context="http:///schema/context"
xsi:schemaLocation="http:///schema/beans
http:///schema/beans/spring-beans-3.1.xsd
http:///schema/context
http:///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>
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="typeAliasesPackage" value="org.entity"></property>
</bean>
<bean id="empMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="org.dao.IEmpMapper"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
<bean id="deptMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="org.dao.IDeptMapper"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
<context:component-scan
base-package="org.dao,org.dao.impl,org.service,org.service.impl"/>
</beans>
版权声明:本文内容来自第三方投稿或授权转载,原文地址:https://blog.51cto.com/u_12718584/2843755,作者:穆雄雄的博客,版权归原作者所有。本网站转在其作品的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如因作品内容、版权等问题需要同本网站联系,请发邮件至ctyunbbs@chinatelecom.cn沟通。
上一篇:#yyds干货盘点#JUnit5学习之五:标签(Tag)和自定义注解
下一篇:postgres 高版本pg备份在低版本pg中恢复