mybatis / spring-native

Apache License 2.0
82 stars 16 forks source link

Support Spring Boot 3 #36

Open kazuki43zoo opened 2 years ago

snicoll commented 1 year ago

@kazuki43zoo let me know if I can help you migrate to the new API in Spring Boot 3. Spring Boot 3.0.0-M5 is available with the required tools to build a native image.

kazuki43zoo commented 1 year ago

@snicoll Sorry to late reply... I want to support to run on Spring Boot 3. Now, I need to your helping !!!!

linghengqian commented 1 year ago
qiangbro commented 1 year ago

同求

gogolin001 commented 1 year ago

SpringBoot3 AOT startup and running error after native compilation e157ee82bbdc4d5005442ec3c7d7ced0_222346640-95b8c87c-1e52-428d-a715-d30b899d68e8

Reason94 commented 1 year ago

Hi, Is there any progress on this issue? I have also meet this problem

snicoll commented 1 year ago

Is this project still relevant though? It seems for Spring Boot 2.x and the now retired project. Folks should use Spring Boot and it's GA version of native support. I believe Mybatis has an integration for Spring Boot 3 as well. Try on start.spring.io?

kazuki43zoo commented 1 year ago

We have a plan to provide support components and meta-data for building native image using Spring Boot 3 on this project or mybatis-spring or mybatis-spring-boot project at late. Until then, please see the mybatis-spring-boot's wiki page.

lumine1996 commented 1 year ago

Hello everyone, here is a demo that support Spring Boot 3 & GraalVM & Mybatis Plus. Plugin native:compile works, but spring-boot:build-image doesn't. https://github.com/lumine1996/lumine-starter @kazuki43zoo @linghengqian

linghengqian commented 1 year ago

Hello everyone, here is a demo that support Spring Boot 3 & GraalVM & Mybatis Plus. Plugin native:compile works, but spring-boot:build-image doesn't. https://github.com/lumine1996/lumine-starter @kazuki43zoo @linghengqian

lumine1996 commented 1 year ago

Hello everyone, here is a demo that support Spring Boot 3 & GraalVM & Mybatis Plus. Plugin native:compile works, but spring-boot:build-image doesn't. https://github.com/lumine1996/lumine-starter @kazuki43zoo @linghengqian

  • @lumine1996 Hi, the Mybatis Plus Example should not be discussed in this issue, I suggest you open a new issue on the baomidou side.

Maybe you misunderstood me, here I want to help those friends. This demo can help you run Mybatis on Spring Boot 3, you can build native image by GraalVM.

mvn -Pnative native:compile -DskipTests

In this demo, because Mybatis Plus is based on Mybatis, so Mybatis also works. As for the problem of the other plugin, that's a remind, but I'd be glad if anyone could help.

elevenkongqian commented 1 year ago

support springboot3 native has some new messages?

iloveuaa commented 1 month ago

Spring Boot v3.3.2, Spring v6.1.11

2024-08-05 16:52:05 DEBUG c.g.xxx                 : Running with Spring Boot v3.3.2, Spring v6.1.11
2024-08-05 16:52:05  INFO c.g.xxx                 : No active profile set, falling back to 1 default profile: "default"
2024-08-05 16:52:05  WARN w.s.c.ServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: java.lang.ExceptionInInitializerError
Application run failed
java.lang.ExceptionInInitializerError
        at org.mybatis.spring.mapper.MapperScannerConfigurer.postProcessBeanDefinitionRegistry(MapperScannerConfigurer.java:363)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:148)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:789)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:607)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
        at com.gz.GzControlApplication.main(GzControlApplication.java:30)
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)
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:47)
        at org.mybatis.logging.LoggerFactory.getLogger(LoggerFactory.java:32)
        at org.mybatis.spring.mapper.ClassPathMapperScanner.<clinit>(ClassPathMapperScanner.java:62)
        ... 10 more
Caused by: java.lang.NullPointerException
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:52)
        ... 13 more
Exception in thread "main" java.lang.IllegalStateException: java.lang.ExceptionInInitializerError
        at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:825)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:345)
        at com.gz.GzControlApplication.main(GzControlApplication.java:30)
Caused by: java.lang.ExceptionInInitializerError
        at org.mybatis.spring.mapper.MapperScannerConfigurer.postProcessBeanDefinitionRegistry(MapperScannerConfigurer.java:363)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:349)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:148)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:789)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:607)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
        ... 1 more
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)
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:47)
        at org.mybatis.logging.LoggerFactory.getLogger(LoggerFactory.java:32)
        at org.mybatis.spring.mapper.ClassPathMapperScanner.<clinit>(ClassPathMapperScanner.java:62)
        ... 10 more
Caused by: java.lang.NullPointerException
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:52)
        ... 13 more
xuxiaowei-com-cn commented 1 month ago

The https://github.com/spring-attic/spring-native used in the project has been archived, and Spring Boot 3 already natively supports native without https://github.com/spring-attic/spring-native

xuxiaowei-com-cn commented 1 month ago

question:

Caused by: java.lang.NullPointerException
        at org.apache.ibatis.logging.LogFactory.getLog(LogFactory.java:52)
        ... 13 more

answer:

reflect-config.json

[
  {
    "name": "org.apache.ibatis.logging.slf4j.Slf4jImpl",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },
  {
    "name": "org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },
  {
    "name": "org.apache.ibatis.logging.log4j2.Log4j2Impl",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },
  {
    "name": "org.apache.ibatis.logging.log4j.Log4jImpl",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },
  {
    "name": "org.apache.ibatis.logging.jdk14.Jdk14LoggingImpl",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  },
  {
    "name": "org.apache.ibatis.logging.nologging.NoLoggingImpl",
    "allDeclaredConstructors": true,
    "allDeclaredMethods": true
  }
]
xuxiaowei-com-cn commented 1 month ago

https://github.com/spring-attic/spring-native

20240806-17-26-23-DESKTOP-8E6LUNV-5563-chrome-vh70FJavNT

xuxiaowei-com-cn commented 1 month ago

Completed debugging of MyBatis functionality for Spring Boot 3.

Please refer to the submission record of the mybatis/native-image branch for details.

https://github.com/xuxiaowei-com-cn/spring-cloud-graalvm

xuxiaowei-com-cn commented 1 month ago

:sparkles: Support MyBatis for Spring Boot 3 Native