mirror of
https://github.com/chillzhuang/blade-tool
synced 2025-01-24 05:31:44 +08:00
✨ 调整关闭 mybatis 默认的日志,避免 NoClassDefFoundError
This commit is contained in:
parent
f2dbad7986
commit
2f8837b855
@ -35,6 +35,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-spring-boot-autoconfigure</artifactId>
|
<artifactId>mybatis-plus-spring-boot-autoconfigure</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mybatis</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
|
@ -41,10 +41,11 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
|||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mybatisplus 配置
|
* mybatis plus 配置
|
||||||
*
|
*
|
||||||
* @author Chill
|
* @author Chill
|
||||||
*/
|
*/
|
||||||
@ -110,20 +111,30 @@ public class MybatisPlusConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关闭 mybatis 默认日志
|
* 内部类配置,避免 NoClassDefFoundError
|
||||||
|
*
|
||||||
|
* @author L.cm
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Configuration
|
||||||
@ConditionalOnClass(MybatisPlusPropertiesCustomizer.class)
|
@ConditionalOnClass(MybatisPlusPropertiesCustomizer.class)
|
||||||
public MybatisPlusPropertiesCustomizer mybatisPlusPropertiesCustomizer() {
|
public static class MybatisPlusPropertiesCustomizerConfiguration {
|
||||||
return properties -> {
|
|
||||||
CoreConfiguration configuration = properties.getConfiguration();
|
/**
|
||||||
if (configuration != null) {
|
* 关闭 mybatis 默认日志
|
||||||
Class<? extends Log> logImpl = configuration.getLogImpl();
|
*/
|
||||||
if (logImpl == null) {
|
@Bean
|
||||||
configuration.setLogImpl(NoLoggingImpl.class);
|
public MybatisPlusPropertiesCustomizer mybatisPlusPropertiesCustomizer() {
|
||||||
|
return properties -> {
|
||||||
|
CoreConfiguration configuration = properties.getConfiguration();
|
||||||
|
if (configuration != null) {
|
||||||
|
Class<? extends Log> logImpl = configuration.getLogImpl();
|
||||||
|
if (logImpl == null) {
|
||||||
|
configuration.setLogImpl(NoLoggingImpl.class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user