最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

MyBatis異常-Property 'configLocation' not specified, using default MyBatis Configuration

 更新時(shí)間:2019年03月26日 10:21:24   作者:徐劉根  
今天小編就為大家分享一篇關(guān)于MyBatis異常-Property 'configLocation' not specified, using default MyBatis Configuration,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧

配置文件如下:

base-context.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-3.2.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  <!--用于激活容器中注冊(cè)的bean-->
  <!--<context:annotation-config/>-->
  <context:property-placeholder location="classpath*:/props/*.properties" ignore-unresolvable="true"/>
  <context:component-scan base-package="com.ufind.server.*">
    <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
  </context:component-scan>
</beans>

db-mybatis.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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="mapperLocations" value="classpath:mybatis/mappers/*.xml"/>
  </bean>
  <bean id="mapperScannerConfigurer" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <property name="basePackage" value="com.ufind.server.infra.repository.sql"/>
    <property name="sqlSessionFactoryBeanName" value="sessionFactory"/>
  </bean>
</beans>

persistence-context.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"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  <bean id="dataSourceTransactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"/>
  </bean>
  <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
     init-method="init" destroy-method="close">
    <!-- 數(shù)據(jù)庫(kù)基本信息配置 -->
    <property name="driverClassName" value="${db.jdbc.driver}"/>
    <property name="url" value="${db.jdbc.connection.url}"/>
    <property name="username" value="${db.jdbc.username}"/>
    <property name="password" value="${db.jdbc.password}"/>
    <!-- 初始化連接數(shù)量 -->
    <property name="initialSize" value="10"/>
    <!-- 最大并發(fā)連接數(shù) -->
    <property name="maxActive" value="100"/>
    <!-- 最小空閑連接數(shù) -->
    <property name="minIdle" value="20"/>
    <!-- 配置獲取連接等待超時(shí)的時(shí)間 -->
    <property name="maxWait" value="5000"/>
    <!-- 超過(guò)時(shí)間限制是否回收 -->
    <property name="removeAbandoned" value="true"/>
    <!-- 超過(guò)時(shí)間限制多長(zhǎng); -->
    <property name="removeAbandonedTimeout" value="120000"/>
    <!-- 配置間隔多久才進(jìn)行一次檢測(cè),檢測(cè)需要關(guān)閉的空閑連接,單位是毫秒 -->
    <property name="timeBetweenEvictionRunsMillis" value="60000"/>
    <!-- 配置一個(gè)連接在池中最小生存的時(shí)間,單位是毫秒 -->
    <property name="minEvictableIdleTimeMillis" value="40000"/>
    <!-- 用來(lái)檢測(cè)連接是否有效的sql,要求是一個(gè)查詢(xún)語(yǔ)句-->
    <property name="validationQuery" value="select 1"/>
    <!-- 申請(qǐng)連接的時(shí)候檢測(cè) -->
    <property name="testWhileIdle" value="true"/>
    <!-- 申請(qǐng)連接時(shí)執(zhí)行validationQuery檢測(cè)連接是否有效,配置為true會(huì)降低性能 -->
    <property name="testOnBorrow" value="false"/>
    <!-- 歸還連接時(shí)執(zhí)行validationQuery檢測(cè)連接是否有效,配置為true會(huì)降低性能 -->
    <property name="testOnReturn" value="false"/>
    <!-- 打開(kāi)PSCache,并且指定每個(gè)連接上PSCache的大小 -->
    <property name="poolPreparedStatements" value="true"/>
    <property name="maxPoolPreparedStatementPerConnectionSize"
         value="50"/>
    <!--屬性類(lèi)型是字符串,通過(guò)別名的方式配置擴(kuò)展插件,常用的插件有:
        監(jiān)控統(tǒng)計(jì)用的filter:stat
        日志用的filter:log4j
        防御SQL注入的filter:wall -->
    <property name="filters" value="stat"/>
  </bean>
</beans>

在mappers下邊是mybatis的xml文件,啟動(dòng)的時(shí)候出現(xiàn)錯(cuò)誤:

DEBUG o.m.spring.SqlSessionFactoryBean - Property 'configLocation' not specified, using default MyBatis Configuration

解決方式如下:

<bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"/>
    <property name="mapperLocations" value="classpath:mybatis/mappers/*.xml"/>
    <property name="configLocation" value="classpath:spring/persistence-context.xml"/>
</bean>

在sessionFactory下加入:

<property name="configLocation" value="classpath:spring/persistence-context.xml"/>

添加persistence-context.xml的位置即可,或者所有的文件都在一個(gè)文件即可

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。如果你想了解更多相關(guān)內(nèi)容請(qǐng)查看下面相關(guān)鏈接

相關(guān)文章

  • 教你從頭開(kāi)始用JAVA創(chuàng)建一個(gè)自己的簡(jiǎn)單API并實(shí)現(xiàn)第三方調(diào)用

    教你從頭開(kāi)始用JAVA創(chuàng)建一個(gè)自己的簡(jiǎn)單API并實(shí)現(xiàn)第三方調(diào)用

    在日常開(kāi)發(fā)的時(shí)候,經(jīng)常會(huì)遇到需要調(diào)用別人的接口的場(chǎng)景,下面這篇文章主要給大家介紹了關(guān)于如何從頭開(kāi)始用JAVA創(chuàng)建一個(gè)自己的簡(jiǎn)單API并實(shí)現(xiàn)第三方調(diào)用的相關(guān)資料,需要的朋友可以參考下
    2023-12-12
  • SpringBoot bean加載順序怎樣查看(源碼解讀)

    SpringBoot bean加載順序怎樣查看(源碼解讀)

    這篇文章主要介紹了SpringBoot bean加載順序怎樣查看(源碼解讀)問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-09-09
  • java阻塞隊(duì)列BlockingQueue詳細(xì)解讀

    java阻塞隊(duì)列BlockingQueue詳細(xì)解讀

    這篇文章主要介紹了java阻塞隊(duì)列BlockingQueue詳細(xì)解讀,在新增的Concurrent包中,BlockingQueue很好的解決了多線程中,如何高效安全“傳輸”數(shù)據(jù)的問(wèn)題,通過(guò)這些高效并且線程安全的隊(duì)列類(lèi),為我們快速搭建高質(zhì)量的多線程程序帶來(lái)極大的便利,需要的朋友可以參考下
    2023-10-10
  • Spring security實(shí)現(xiàn)記住我下次自動(dòng)登錄功能過(guò)程詳解

    Spring security實(shí)現(xiàn)記住我下次自動(dòng)登錄功能過(guò)程詳解

    這篇文章主要介紹了Spring security實(shí)現(xiàn)記住我下次自動(dòng)登錄功能過(guò)程詳解,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-03-03
  • Java進(jìn)階之SPI機(jī)制詳解

    Java進(jìn)階之SPI機(jī)制詳解

    Java SPI機(jī)制在很多大型中間建碼,例如Dubbo中均有采用,屬于高級(jí)Java開(kāi)發(fā)的進(jìn)階必備知識(shí)點(diǎn),務(wù)必要求掌握.文中有非常詳細(xì)的代碼示例及解釋,需要的朋友可以參考下
    2021-05-05
  • 解決Springboot啟動(dòng)報(bào)錯(cuò):類(lèi)文件具有錯(cuò)誤的版本61.0,應(yīng)為?52.0

    解決Springboot啟動(dòng)報(bào)錯(cuò):類(lèi)文件具有錯(cuò)誤的版本61.0,應(yīng)為?52.0

    這篇文章主要給大家介紹了關(guān)于解決Springboot啟動(dòng)報(bào)錯(cuò):類(lèi)文件具有錯(cuò)誤的版本?61.0,應(yīng)為?52.0的相關(guān)資料,這是查閱了網(wǎng)上的很多資料才解決的,分享給大家,需要的朋友可以參考下
    2023-01-01
  • idea?maven依賴(lài)引入失效無(wú)法正常導(dǎo)入依賴(lài)問(wèn)題的解決方法

    idea?maven依賴(lài)引入失效無(wú)法正常導(dǎo)入依賴(lài)問(wèn)題的解決方法

    有時(shí)候idea導(dǎo)入一個(gè)新項(xiàng)目,或者pom文件修改(新增)了依賴(lài),pom文件和代碼會(huì)報(bào)紅,提示依賴(lài)包不存在,下面這篇文章主要給大家介紹了關(guān)于idea?maven依賴(lài)引入失效無(wú)法正常導(dǎo)入依賴(lài)問(wèn)題的解決方法,需要的朋友可以參考下
    2023-04-04
  • java隊(duì)列中Queue與Deque的區(qū)別面試精講

    java隊(duì)列中Queue與Deque的區(qū)別面試精講

    這篇文章主要為大家介紹了java隊(duì)列中Queue與Deque的區(qū)別面試精講,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-10-10
  • springcloud部署提示 找不到url的解決

    springcloud部署提示 找不到url的解決

    這篇文章主要介紹了springcloud部署提示 找不到url的解決方案,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教。
    2022-01-01
  • Spring boot Mybatis 整合(完整版)

    Spring boot Mybatis 整合(完整版)

    本文是一篇比較完整的版本通過(guò)圖文并茂的形式給大家介紹了Spring boot Mybatis 整合過(guò)程,感興趣的朋友跟隨腳本之家小編一起看看吧
    2018-09-09

最新評(píng)論

襄城县| 二连浩特市| 自治县| 凤阳县| 龙海市| 株洲市| 云霄县| 陈巴尔虎旗| 新营市| 虹口区| 施甸县| 唐河县| 枞阳县| 邯郸县| 磐石市| 临西县| 玛曲县| 东乌珠穆沁旗| 长宁区| 平邑县| 永康市| 岱山县| 探索| 满城县| 谢通门县| 左贡县| 砀山县| 白沙| 通城县| 乌海市| 顺平县| 菏泽市| 芦溪县| 周宁县| 河西区| 通城县| 西盟| 淮北市| 龙陵县| 鄂托克前旗| 乌兰浩特市|