application.xml

发布时间:2022-07-05 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了application.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"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">

    <context:proPErty-placeholder location="jdbc.properties"/>

    <!--    声明数据-->
    <bean id="myDataSource" class="com.alibaba.druid.pool.DruidDataSource" inIT-method="init" destroy-method="close">
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean>

    <!--声明 SQLSessionFactory-->
    <bean id="factory" class="org.mybatis.spring.SqlSessionFactoryBean">
        <!--指定数据源-->
        <property name="dataSource" ref="myDataSource"/>
        <property name="configLocation" value="classpath:mybatis.xml"/>
    </bean>

    <!--    创建所有的DAO对象-->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="sqlSessionFactoryBeanName" value="factory"/>
        <property name="basePackage" value="dao的全限定包名"/>
    </bean>

    <!--创建service-->
    <bean id="studentService" class="com.zx.service.impl.StudentServiceimpl">
        <property name="dao名" ref="dao名首字母小写"/>
    </bean>
    
</beans>

&nbsp;

脚本宝典总结

以上是脚本宝典为你收集整理的application.xml全部内容,希望文章能够帮你解决application.xml所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。