mysql 注入 3.0,3.0.1注入全局sql 项目启动报错 就添加下面的代码之后就启动报错 回退之后就不会了...

```

package com.polysoft.ins.common.config;

import org.apache.ibatis.mapping.MappedStatement;

import org.apache.ibatis.mapping.SqlSource;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;

import com.baomidou.mybatisplus.core.metadata.TableInfo;

public class SelectAll extends AbstractMethod {

@Override

public MappedStatement injectMappedStatement(Class> mapperClass, Class> modelClass, TableInfo tableInfo) {

/* 执行 SQL ,动态 SQL 参考类 SqlMethod */

String sql = "select * from " + tableInfo.getTableName();

/* mapper 接口方法名一致 */

String method = "selectAll";

SqlSource sqlSource = languageDriver.createSqlSource(configuration, sql, modelClass);

return this.addSelectMappedStatement(mapperClass, method, sqlSource, modelClass, tableInfo);

}

}

```

```

package com.polysoft.ins.common.config;

import java.util.List;

import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;

import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;

@Component

public class MySqlInjector extends DefaultSqlInjector {

@Override

public List getMethodList() {

List methodList = super.getMethodList();

//增加自定义方法

methodList.add(new SelectAll());

return methodList;

}

}

```

```

public interface InsBaseMapper extends BaseMapper{

List selectAll();

}

```

报错信息如下

```

2018-09-07 18:45:16.782 WARN [ins-user,,,] 74245 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'channelController': Unsatisfied dependency expressed through field 'channelService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'channelService': Unsatisfied dependency expressed through field 'channelMapper'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'channelMapper' defined in file [/Users/apple/Desktop/huayun/ins-user/target/classes/com/polysoft/ins/user/mapper/ChannelMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'com.baomidou.mybatisplus.core.injector.ISqlInjector' available: expected single matching bean but found 3: mySqlInjector,myLogicSqlInjector,sqlInjector

2018-09-07 18:45:16.805 INFO [ins-user,,,] 74245 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed

2018-09-07 18:45:17.639 INFO [ins-user,,,] 74245 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]

2018-09-07 18:45:17.644 WARN [ins-user,,,] 74245 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [RxIoScheduler-1 (Evictor)] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:

sun.misc.Unsafe.park(Native Method)

java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)

java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078)

java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1093)

java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:809)

java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1067)

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1127)

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

java.lang.Thread.run(Thread.java:745)

2018-09-07 18:45:17.666 INFO [ins-user,,,] 74245 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2018-09-07 18:45:17.673 ERROR [ins-user,,,] 74245 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

***************************

APPLICATION FAILED TO START

***************************

Description:

file [/Users/apple/Desktop/huayun/ins-user/target/classes/com/polysoft/ins/user/mapper/ChannelMapper.class] required a single bean, but 3 were found:

- mySqlInjector: defined in file [/Users/apple/Desktop/huayun/ins-common/target/classes/com/polysoft/ins/common/config/MySqlInjector.class]

- myLogicSqlInjector: defined by method 'myLogicSqlInjector' in class path resource [com/polysoft/ins/common/config/MyBatisPlusConfig.class]

- sqlInjector: defined by method 'sqlInjector' in class path resource [com/polysoft/ins/common/config/MyBatisPlusConfig.class]

Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

```

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
openssl-3.0.1.tar.gz是一个软件包的压缩文件,可用于安装OpenSSL 3.0.1版本。要下载该文件,可以按照以下步骤进行操作: 1. 打开一个网页浏览器,进入OpenSSL的官方网站。可以使用搜索引擎搜索“OpenSSL官方网站”来找到正确的链接。 2. 在网站上找到下载页面或者下载区域,一般位于网站的首页或者产品页面。对于较新版本的软件,你可能需要点击“下载”或类似的按钮。 3. 查找OpenSSL 3.0.1的下载链接。根据网站的设计和布局,下载链接可能会以文本或按钮的形式出现。在找到相应的链接之前,可能需要浏览或搜索页面。 4. 单击或者右键点击下载链接,选择“保存链接为”(Save Link As)或“另存为”(Save As)等浏览器选项。这将弹出一个文件保存对话框。 5. 在文件保存对话框中,选择一个合适的保存位置,并将文件命名为"openssl-3.0.1.tar.gz"或其他你喜欢的名称。 6. 单击“保存”按钮来开始文件下载。下载速度取决于你的网络连接和服务器的响应速度。 7. 下载完成后,导航到你保存的文件所在的文件夹,并解压缩.tar.gz文件。你可以使用压缩软件(如WinRAR、7-Zip等)来执行此操作。 这样,你就可以成功下载和解压OpenSSL 3.0.1的.tar.gz文件,并可以根据软件的安装指南进行安装和配置。请注意,下载文件时要确保获取来自受信任的来源,以避免下载到恶意软件或病毒。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值