第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

@Qualifier注解后的dataSource飄紅

package com.imooc.demo.config.dao;

import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import javax.activation.DataSource;
import java.io.IOException;

@Configuration
public class SessionFactoryConfiguration {
// ? ?mybatis-config.xml配置文件的路徑
? ?@Value("${mybatis_config_file}")
? ?private String mybatisConfigFilePath;

// ? ?mybatis mapper文件所在路徑
? ?@Value("${mapper_path}")
? ?private String mapperPath;

// ? ?實體類所在的package
? ?@Value("${entity_package}")
? ?private String entityPackage;

? ?@Autowired
? ?@Qualifier("dataSource")//這個地方!?。。。。?!
? ?private DataSource dataSource;

? ?@Bean(name = "sqlSessionFactory")
? ?public SqlSessionFactoryBean createSqlSessionFactoryBean() throws IOException {
? ? ? ?SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
? ? ? ?sqlSessionFactoryBean.setConfigLocation(new ClassPathResource(mybatisConfigFilePath));
? ? ? ?PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
? ? ? ?String packageSearchPath = PathMatchingResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX+ mapperPath;
? ? ? ?sqlSessionFactoryBean.setMapperLocations(resolver.getResources(packageSearchPath));
? ? ? ?sqlSessionFactoryBean.setDataSource((javax.sql.DataSource) dataSource);
? ? ? ?sqlSessionFactoryBean.setTypeAliasesPackage(entityPackage);
? ? ? ?return sqlSessionFactoryBean;
? ?}
}


正在回答

3 回答

https://img1.sycdn.imooc.com//5b21d6260001df1904980135.jpg

不用理會,你可以在錯誤檢查里面關掉。

0 回復 有任何疑惑可以回復我~

我也是相同問題https://img1.sycdn.imooc.com//5b21d508000106fd10010477.jpg

0 回復 有任何疑惑可以回復我~

提示的錯誤問題是什么啊

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

@Qualifier注解后的dataSource飄紅

我要回答 關注問題
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號