搭建 ssm 环境

 <!-- 引入外部jdbc配置文件 -->

<context:property-placeholder location="classpath:dbconfig.properties"></context:property-placeholder>

像这种类型的都要加上 classpath: 才能正常找到,idea编辑时不加也能访问到,但是要让程序运行起来还找到就必须加上



<!-- 配置和mybatis的整合 -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <!-- 指定mybatis全局配置文件的位置 -->
    <property name="configLocation" value="classpath:mybatis-config.xml"></property>
    <property name="dataSource" ref="pooledDataSource"></property>
    <!-- 指定mybatis mapper文件的位置 -->
    <property name="mapperLocations" value="classpath:mapper/*.xml"></property>
</bean>
这里 mapper 文件的位置进行了路径修改来解决异常

猜你喜欢

转载自www.cnblogs.com/kinome/p/9104774.html