mybatis / spring-boot-starter

MyBatis integration with Spring Boot
Apache License 2.0
4.15k stars 1.79k forks source link

:sparkles: Support annotation based on MyBatis for Spring Boot 3 Native #995

Open xuxiaowei-com-cn opened 3 months ago

xuxiaowei-com-cn commented 3 months ago

https://github.com/mybatis/spring-boot-starter/issues/994

xuxiaowei-com-cn commented 3 months ago

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

我添加了一个基于Ubuntu和macOS的流水线来测试原生应用程序,现在它已经通过了测试

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

iloveuaa commented 3 months ago

good job. need it

hazendaz commented 2 months ago

Hi @xuxiaowei-com-cn, I'm not all that familiar with the native aspect. I know we have a project for spring native that has had issues for a while and on obsolete path. Does this replace that or complement it? Is this work completely done? Its a lot of changes so I want to be sure what I'm reviewing before spending a lot of time on it.

xuxiaowei-com-cn commented 2 months ago

Hi @hazendaz , This function is used for replacement https://github.com/mybatis/spring-native, This function is not yet completed, with the following defects:

  1. The resultType in Mapper XML must use sample.mybatis.graalvm.xml.domain.City instead of City, for example:

    <mapper namespace="sample.mybatis.graalvm.xml.mapper.CityMapper">
      <select id="selectCityById" resultType="sample.mybatis.graalvm.xml.domain.City">
        select id, name, state, country from city where id = #{id}
      </select>
    </mapper>
  2. mybatis.config-location=classpath:mybatis-config.xml is not supported and requires the use of src/main/resources/META-INF/native-image/resource-config.json, for example:

    {
      "resources": {
        "includes": [
          { "pattern": "sample/mybatis/graalvm/xml/mapper/CityMapper.xml" },
          { "pattern": "sample/mybatis/graalvm/xml/mapper/HotelMapper.xml" }
        ]
      }
    }