激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務器之家:專注于服務器技術及軟件下載分享
分類導航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術|正則表達式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

香港云服务器
服務器之家 - 編程語言 - Java教程 - MyBatis異常-Property 'configLocation' not specified, using default MyBatis Configuration

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

2021-07-25 16:16徐劉根 Java教程

今天小編就為大家分享一篇關于MyBatis異常-Property 'configLocation' not specified, using default MyBatis Configuration,小編覺得內容挺不錯的,現在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧

配置文件如下:

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

base-context.xml文件如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
<?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">
  <!--用于激活容器中注冊的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如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
<?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文件如下:

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?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">
    <!-- 數據庫基本信息配置 -->
    <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}"/>
    <!-- 初始化連接數量 -->
    <property name="initialSize" value="10"/>
    <!-- 最大并發連接數 -->
    <property name="maxActive" value="100"/>
    <!-- 最小空閑連接數 -->
    <property name="minIdle" value="20"/>
    <!-- 配置獲取連接等待超時的時間 -->
    <property name="maxWait" value="5000"/>
    <!-- 超過時間限制是否回收 -->
    <property name="removeAbandoned" value="true"/>
    <!-- 超過時間限制多長; -->
    <property name="removeAbandonedTimeout" value="120000"/>
    <!-- 配置間隔多久才進行一次檢測,檢測需要關閉的空閑連接,單位是毫秒 -->
    <property name="timeBetweenEvictionRunsMillis" value="60000"/>
    <!-- 配置一個連接在池中最小生存的時間,單位是毫秒 -->
    <property name="minEvictableIdleTimeMillis" value="40000"/>
    <!-- 用來檢測連接是否有效的sql,要求是一個查詢語句-->
    <property name="validationQuery" value="select 1"/>
    <!-- 申請連接的時候檢測 -->
    <property name="testWhileIdle" value="true"/>
    <!-- 申請連接時執行validationQuery檢測連接是否有效,配置為true會降低性能 -->
    <property name="testOnBorrow" value="false"/>
    <!-- 歸還連接時執行validationQuery檢測連接是否有效,配置為true會降低性能 -->
    <property name="testOnReturn" value="false"/>
    <!-- 打開PSCache,并且指定每個連接上PSCache的大小 -->
    <property name="poolPreparedStatements" value="true"/>
    <property name="maxPoolPreparedStatementPerConnectionSize"
         value="50"/>
    <!--屬性類型是字符串,通過別名的方式配置擴展插件,常用的插件有:
        監控統計用的filter:stat
        日志用的filter:log4j
        防御SQL注入的filter:wall -->
    <property name="filters" value="stat"/>
  </bean>
</beans>

在mappers下邊是mybatis的xml文件,啟動的時候出現錯誤:

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

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

解決方式如下:

?
1
2
3
4
5
<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下加入:

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

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

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對服務器之家的支持。如果你想了解更多相關內容請查看下面相關鏈接

原文鏈接:https://blog.csdn.net/xlgen157387/article/details/50885635

延伸 · 閱讀

精彩推薦
769
主站蜘蛛池模板: 国产乱子视频 | 1314av| 久久久久国产成人免费精品免费 | 欧美一级高潮 | 91精品国产九九九久久久亚洲 | 欧美成人影院 | 黄色毛片免费视频 | 久色免费| 欧美一级做a | 蜜桃视频观看麻豆 | 日韩激情一区 | 美女毛片在线观看 | 91久久国产露脸精品国产护士 | 欧美日韩亚洲国产精品 | 亚洲成人精品久久 | 国产超碰人人爽人人做人人爱 | 麻豆视频国产在线观看 | 91av久久 | 国产99久久久久久免费看农村 | 久久精品视频网站 | asiass极品裸体女pics | 娇喘在线 | 亚洲综合精品 | 久草在线最新免费 | 72pao成人国产永久免费视频 | 成人毛片视频免费看 | 亚洲视屏在线 | 亚洲天堂岛国片 | 亚洲精品毛片一区二区三区 | 亚洲αv| 国产精品久久久久久久久久东京 | 九九视屏 | 免费观看一级黄色片 | 久久另类视频 | 欧美重口另类videos人妖 | 黄色一级视频 | 羞羞视频一区 | 久久精品中文字幕一区 | 日韩视频在线观看免费视频 | 国产88久久久国产精品免费二区 | 亚洲影院在线 |