springboot load java xml file in the directory when the package

Recently found the time to roll up the project of a problem when using mybatis-plus, you need to have a place to use sql statement, so, I wrote a xml file in java catalog
Here Insert Picture Description
written in the xml file statements, there can not run results found, note did not go in a package
such cases, there are two approaches:
1, the xml files into resources in
2, pom file as follows

 <build>
        <!--项目打包时会讲java目录中的*.xml文件也进行打包-->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
                <filtering>false</filtering>
            </resource>
        </resources>
    </build>

Also in the application.ymlconfiguration file, of course, the path may be based on the actual

mybatis-plus:
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  mapper-locations: classpath:com/zeny/edu/eduservice/mapper/xml/*.xml

Finally came loaded
Here Insert Picture Description

Published 26 original articles · won praise 0 · Views 559

Guess you like

Origin blog.csdn.net/qq_36609994/article/details/104688054