mybatis the design layer encoding step dao

/**

    Writing pojo class ------ "dao Interface ------" established under the same path resources dao.xml ------ "configuration file 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: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
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
HTTP: // the WWW .springframework.org / Schema / AOP / the Spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
HTTP: // www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd " > <! - DAO layer profile start -> <! - configuration data sources - -> <the bean ID = "the dataSource" class = "com.alibaba.druid.pool.DruidDataSource" > <Property name = "driverClassName"value="com.mysql.jdbc.Driver"





/>
<Property name = "URL" value = "JDBC: MySQL: /// Maven" />
<Property name = "username" value = "the root" />
<Property name = "password" value = "123" / >
</ the bean>

<-! the SqlSession production factory configuration ->
<the bean ID = "SqlSessionFactory" class = "org.mybatis.spring.SqlSessionFactoryBean">
<Property name = "the dataSource" REF = "the dataSource" / >
<! - package pojo scan, to all the objects in the bag from pojo alias ->
<Property name = "typeAliasesPackage" value = "com.hope.domain" />
</ the bean>

<-! scan interface packet routing, all packets generated interface proxy object, the spring and placed into a container ->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.hope.dao"/>
</bean>
<!--dao层配置文件结束-->

</beans>

   

Guess you like

Origin www.cnblogs.com/newcityboy/p/11985429.html