Skip to content

Fix native image quick start guide, use offline entity resolver for the MyBatis DTDs #852

Closed
@andres-3

Description

@andres-3

There is issue with Quick Start for building native image: the instructions for additional build and runtime args in "Appendix: How To use XML based Mapper" are not necessary. Instead of using these args, fix the error in example configuration file MyBatisNativeConfiguration.java, method "registerHints": remove the "dot" before asterisk from resources pattern. So it should be

      Stream.of(
          "org/apache/ibatis/builder/xml/*.dtd",
          "org/apache/ibatis/builder/xml/*.xsd"
      ).forEach(hints.resources()::registerPattern);

After that change, mybatis with spring boot 3 native image is able to work offline and use classpath resource from library org/apache/ibatis/builder/xml/mybatis-3-mapper.dtd instead of http://mybatis.org/dtd/mybatis-3-mapper.dtd

Not to mention, that the remote dtd file is anyway slightly outdated and missing some metadata from latest mybatis 3.5.11 release - for example "nullable" field from "foreach" element

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions