baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.42k stars 4.31k forks source link

spring navtive compile 支持 #5684

Closed lizhongyue248 closed 1 year ago

lizhongyue248 commented 1 year ago

当前使用版本(必填,否则不予处理)

dependencies {
    implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.3.2'
    implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    runtimeOnly 'com.mysql:mysql-connector-j'
    annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    testImplementation 'org.springframework.boot:spring-boot-testcontainers'
    testImplementation 'org.testcontainers:junit-jupiter'
    testImplementation 'org.testcontainers:mysql'
}

该问题是如何引起的?(确定最新版也有问题再提!!!)

nativeCompile 构建 native 项目,运行 $ build/native/nativeCompile/myproject 发生错误

重现步骤(如果有就写完整)

  1. 新建 spring boot 3 项目,添加依赖信息
  2. 编写一个查询接口
  3. 使用 gradle nativeCompile 打包项目
  4. 运行生成后的文件$ build/native/nativeCompile/myproject

报错信息


  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.4)

2023-09-27T20:08:59.490+08:00  INFO 34450 --- [           main] i.m.trustformer.TrustformerApplication   : Starting AOT-processed TrustformerApplication using Java 17.0.5 with PID 34450 (trustformer)
2023-09-27T20:08:59.491+08:00 DEBUG 34450 --- [           main] i.m.trustformer.TrustformerApplication   : Running with Spring Boot v3.1.4, Spring v6.0.12
2023-09-27T20:08:59.491+08:00  INFO 34450 --- [           main] i.m.trustformer.TrustformerApplication   : No active profile set, falling back to 1 default profile: "default"
2023-09-27T20:08:59.498+08:00 ERROR 34450 --- [           main] o.s.boot.SpringApplication               : Application run failed

java.lang.ExceptionInInitializerError: null
        at org.mybatis.spring.mapper.MapperScannerConfigurer.postProcessBeanDefinitionRegistry(MapperScannerConfigurer.java:363) ~[trustformer:2.1.1]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:344) ~[na:na]
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:145) ~[na:na]
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:771) ~[trustformer:6.0.12]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:589) ~[trustformer:6.0.12]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[trustformer:3.1.4]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) ~[trustformer:3.1.4]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:439) ~[trustformer:3.1.4]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) ~[trustformer:3.1.4]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) ~[trustformer:3.1.4]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) ~[trustformer:3.1.4]
        at io.metatrust.trustformer.TrustformerApplication.main(TrustformerApplication.java:10) ~[trustformer:na]
Caused by: org.apache.ibatis.logging.LogException: Error creating logger for logger org.mybatis.spring.mapper.ClassPathMapperScanner.  Cause: java.lang.NullPointerException
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:54) ~[na:na]
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:47) ~[na:na]
        at org.mybatis.logging.LoggerFactory.getLogger(LoggerFactory.java:32) ~[na:na]
        at org.mybatis.spring.mapper.ClassPathMapperScanner.<clinit>(ClassPathMapperScanner.java:60) ~[na:na]
        ... 12 common frames omitted
Caused by: java.lang.NullPointerException: null
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:52) ~[na:na]
        ... 15 common frames omitted
lizhongyue248 commented 1 year ago

重复 #2747