diff --git a/pom.xml b/pom.xml
index 810fc58b31..ae20a9326a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,6 +117,7 @@
7.0.1
4.0.0
5.2.4
+ 2.0.17
org.mybatis.spring
6.0.1
@@ -165,6 +166,13 @@
true
+
+ org.slf4j
+ slf4j-api
+ ${slf4j.version}
+ provided
+
+
@@ -246,7 +254,7 @@
org.slf4j
slf4j-simple
- 2.0.17
+ ${slf4j.version}
test
diff --git a/src/main/java/org/mybatis/spring/mapper/ClassPathMapperScanner.java b/src/main/java/org/mybatis/spring/mapper/ClassPathMapperScanner.java
index 62955111e1..6befaa48f0 100644
--- a/src/main/java/org/mybatis/spring/mapper/ClassPathMapperScanner.java
+++ b/src/main/java/org/mybatis/spring/mapper/ClassPathMapperScanner.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2010-2024 the original author or authors.
+ * Copyright 2010-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,9 +23,9 @@
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
-import org.mybatis.logging.Logger;
-import org.mybatis.logging.LoggerFactory;
import org.mybatis.spring.SqlSessionTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.aop.scope.ScopedProxyFactoryBean;
import org.springframework.aop.scope.ScopedProxyUtils;
import org.springframework.aot.AotDetector;
@@ -256,8 +256,8 @@ public Set doScan(String... basePackages) {
if (beanDefinitions.isEmpty()) {
if (printWarnLogIfNotFoundMappers) {
- LOGGER.warn(() -> "No MyBatis mapper was found in '" + Arrays.toString(basePackages)
- + "' package. Please check your configuration.");
+ LOGGER.warn("No MyBatis mapper was found in '{}' package. Please check your configuration.",
+ Arrays.toString(basePackages));
}
} else {
processBeanDefinitions(beanDefinitions);
@@ -280,8 +280,8 @@ private void processBeanDefinitions(Set beanDefinitions) {
scopedProxy = true;
}
var beanClassName = definition.getBeanClassName();
- LOGGER.debug(() -> "Creating MapperFactoryBean with name '" + holder.getBeanName() + "' and '" + beanClassName
- + "' mapperInterface");
+ LOGGER.debug("Creating MapperFactoryBean with name '{}' and '{}' mapperInterface", holder.getBeanName(),
+ beanClassName);
// the mapper interface is the original class of the bean
// but, the actual class of the bean is MapperFactoryBean
@@ -314,7 +314,7 @@ private void processBeanDefinitions(Set beanDefinitions) {
if (StringUtils.hasText(this.sqlSessionTemplateBeanName)) {
if (explicitFactoryUsed) {
LOGGER.warn(
- () -> "Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
+ "Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
}
definition.getPropertyValues().add("sqlSessionTemplate",
new RuntimeBeanReference(this.sqlSessionTemplateBeanName));
@@ -322,14 +322,14 @@ private void processBeanDefinitions(Set beanDefinitions) {
} else if (this.sqlSessionTemplate != null) {
if (explicitFactoryUsed) {
LOGGER.warn(
- () -> "Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
+ "Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
}
definition.getPropertyValues().add("sqlSessionTemplate", this.sqlSessionTemplate);
explicitFactoryUsed = true;
}
if (!explicitFactoryUsed) {
- LOGGER.debug(() -> "Enabling autowire by type for MapperFactoryBean with name '" + holder.getBeanName() + "'.");
+ LOGGER.debug("Enabling autowire by type for MapperFactoryBean with name '{}'.", holder.getBeanName());
definition.setAutowireMode(AbstractBeanDefinition.AUTOWIRE_BY_TYPE);
}
@@ -364,8 +364,9 @@ protected boolean checkCandidate(String beanName, BeanDefinition beanDefinition)
if (super.checkCandidate(beanName, beanDefinition)) {
return true;
}
- LOGGER.warn(() -> "Skipping MapperFactoryBean with name '" + beanName + "' and '"
- + beanDefinition.getBeanClassName() + "' mapperInterface" + ". Bean already defined with the same name!");
+ LOGGER.warn(
+ "Skipping MapperFactoryBean with name '{}' and '{}' mapperInterface. Bean already defined with the same name!",
+ beanName, beanDefinition.getBeanClassName());
return false;
}