Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Support MyBatis for Spring Boot 3 Native #994

Open
xuxiaowei-com-cn opened this issue Aug 7, 2024 · 2 comments
Open

✨ Support MyBatis for Spring Boot 3 Native #994

xuxiaowei-com-cn opened this issue Aug 7, 2024 · 2 comments

Comments

@xuxiaowei-com-cn
Copy link

xuxiaowei-com-cn commented Aug 7, 2024

Premise

  1. org.springframework.experimental:spring-aot Repository: https://github.com/spring-attic/spring-native : EOL
  2. org.springframework.experimental:spring-aot Repository: https://github.com/spring-attic/spring-native : This
    project is now superseded by Spring Boot 3+ official native support,
    see the related reference documentation
    for more details.
  3. org.springframework.experimental:spring-aot Repository: https://github.com/spring-attic/spring-native : Only
    supports Spring Boot 2, not Spring Boot 3
  4. org.mybatis.spring.native:mybatis-spring-native-core Repository: https://github.com/mybatis/spring-native :
    Used org.springframework.experimental:spring-aot

前提

  1. org.springframework.experimental:spring-aot 仓库: https://github.com/spring-attic/spring-native : 寿命终止
  2. org.springframework.experimental:spring-aot 仓库: https://github.com/spring-attic/spring-native : 该项目现已被
    Spring Boot 3+
    官方原生支持所取代,请参阅 相关参考文档
    了解更多详情。
  3. org.springframework.experimental:spring-aot 仓库: https://github.com/spring-attic/spring-native : 仅支持 Spring
    Boot 2,不支持 Spring Boot 3
  4. org.mybatis.spring.native:mybatis-spring-native-core 仓库: https://github.com/mybatis/spring-native :
    使用了 org.springframework.experimental:spring-aot

Principle

  1. Use the following configuration file types as much as possible to avoid affecting the project in non native scenarios
    as much as possible
    1. reflect-config.json
    2. jni-config.json
    3. resource-config.json
    4. proxy-config.json
    5. serialization-config.json
    6. preset-classes-config.json
  2. Try to automatically configure and use it out of the box to avoid burdening users

原则

  1. 尽量多的使用以下配置文件类型,尽可能的避免在非 native 场景下影响项目
    1. reflect-config.json
    2. jni-config.json
    3. resource-config.json
    4. proxy-config.json
    5. serialization-config.json
    6. preset-classes-config.json
  2. 尽量自动配置,开箱即用,避免对使用者造成负担

New Features

  1. Increase Native pipeline construction and product testing, including: Ubuntu/MacOS GraalVM JDK 17/21/22
  2. When adding native builds, mybatis.comnfig-location is configured to recognize and automatically import resource
    files
  3. When adding native builds, mybatis.mapper-locations is configured to recognize and automatically import resource
    files
  4. Add dynamic proxy for Mapper interface when building Native
  5. When adding native builds, the default type of returned data is automatically reflected, including:
    1. java.util.ArrayList
    2. java.util.HashMap
    3. java.util.TreeSet
    4. java.util.HashSet
  6. When adding native builds, return data with custom types for automatic reflection
  7. When adding native builds, ibatis logging automatically reflects:
    1. org.apache.ibatis.logging.slf4j.Slf4jImpl
    2. org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl
    3. org.apache.ibatis.logging.log4j2.Log4j2Impl
    4. org.apache.ibatis.logging.log4j.Log4jImpl
    5. org.apache.ibatis.logging.jdk14.Jdk14LoggingImpl
    6. org.apache.ibatis.logging.nologging.NoLoggingImpl
  8. When adding native builds, the required class reflection is:
    1. org.apache.ibatis.plugin.Interceptor
    2. org.apache.ibatis.javassist.util.proxy.ProxyFactory
    3. org.apache.ibatis.scripting.xmltags.XMLLanguageDriver
    4. org.apache.ibatis.scripting.defaults.RawLanguageDriver
    5. org.mybatis.spring.SqlSessionFactoryBean
    6. org.apache.ibatis.session.Configuration
    7. org.mybatis.spring.boot.autoconfigure.SpringBootVFS
  9. Add static resource import when building Native
    1. org/apache/ibatis/builder/xml/mybatis-3-config.dtd
    2. org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd
    3. org/apache/ibatis/builder/xml/mybatis-config.xsd
    4. org/apache/ibatis/builder/xml/mybatis-mapper.xsd
  10. When adding native builds, MyBatis annotation examples are supported
  11. When adding native builds, MyBatis XML examples support

新功能

  1. 增加 Native 流水线构建、产物测试,包含:Ubuntu/MacOS GraalVM JDK 17/21/22
  2. 增加 Native 构建时,mybatis.config-location 配置识别,自动执行资源文件导入
  3. 增加 Native 构建时,mybatis.mapper-locations 配置识别,自动执行资源文件导入
  4. 增加 Native 构建时,Mapper 接口动态代理
  5. 增加 Native 构建时,返回数据默认类型自动反射,包含:
    1. java.util.ArrayList
    2. java.util.HashMap
    3. java.util.TreeSet
    4. java.util.HashSet
  6. 增加 Native 构建时,返回数据自定义类型自动反射
  7. 增加 Native 构建时,ibatis logging 自动反射:
    1. org.apache.ibatis.logging.slf4j.Slf4jImpl
    2. org.apache.ibatis.logging.commons.JakartaCommonsLoggingImpl
    3. org.apache.ibatis.logging.log4j2.Log4j2Impl
    4. org.apache.ibatis.logging.log4j.Log4jImpl
    5. org.apache.ibatis.logging.jdk14.Jdk14LoggingImpl
    6. org.apache.ibatis.logging.nologging.NoLoggingImpl
  8. 增加 Native 构建时,所需 class 反射:
    1. org.apache.ibatis.plugin.Interceptor
    2. org.apache.ibatis.javassist.util.proxy.ProxyFactory
    3. org.apache.ibatis.scripting.xmltags.XMLLanguageDriver
    4. org.apache.ibatis.scripting.defaults.RawLanguageDriver
    5. org.mybatis.spring.SqlSessionFactoryBean
    6. org.apache.ibatis.session.Configuration
    7. org.mybatis.spring.boot.autoconfigure.SpringBootVFS
  9. 增加 Native 构建时,静态资源导入
    1. org/apache/ibatis/builder/xml/mybatis-3-config.dtd
    2. org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd
    3. org/apache/ibatis/builder/xml/mybatis-config.xsd
    4. org/apache/ibatis/builder/xml/mybatis-mapper.xsd
  10. 增加 Native 构建时,MyBatis annotation 示例支持
  11. 增加 Native 构建时,MyBatis xml 示例支持
@xuxiaowei-com-cn
Copy link
Author

I added a pipeline based on Ubuntu and macOS for testing native applications, and it has now passed the test

https://github.com/xuxiaowei-com-cn/mybatis-spring-boot-starter/actions/workflows/native.yaml

@xuxiaowei-com-cn
Copy link
Author

xuxiaowei-com-cn commented Aug 8, 2024

I personally develop my computer using Windows.
The Windows pipeline requires the following conditions, which I have not been able to solve yet.

我个人开发使用 Windows 电脑。
Windows 运行需要安装以下软件,流水线尚未解决。

  • install Visual Studio 2022 version 17.6.0 or later, and Microsoft Visual C++ (MSVC).

xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 8, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 8, 2024
mybatis#994

1. org.springframework.experimental:spring-aot use org.springframework.context.annotation.BeanDefinitionPostProcessor, but org.springframework.experimental:spring-aot only supported Spring Boot 2, EOL
2. Spring Boot 3 use org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 8, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 8, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 9, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 25, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 25, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 25, 2024
mybatis#994

1. org.springframework.experimental:spring-aot use org.springframework.context.annotation.BeanDefinitionPostProcessor, but org.springframework.experimental:spring-aot only supported Spring Boot 2, EOL
2. Spring Boot 3 use org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 25, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 25, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Aug 25, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Oct 17, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Oct 17, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Oct 17, 2024
mybatis#994

1. org.springframework.experimental:spring-aot use org.springframework.context.annotation.BeanDefinitionPostProcessor, but org.springframework.experimental:spring-aot only supported Spring Boot 2, EOL
2. Spring Boot 3 use org.springframework.beans.factory.support.MergedBeanDefinitionPostProcessor
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Oct 17, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Oct 17, 2024
xuxiaowei-com-cn added a commit to xuxiaowei-com-cn/mybatis-spring-boot-starter that referenced this issue Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant