Closed ruimo closed 4 years ago
@ruimo Thanks for your reporting!!
I've investigated this behavior. This behavior is bug when use together with Spring Boot FatJar.
The Resources.getResourceAsFile(actualPath).exists()
return false
always on Spring Boot FatJar.
I will change that not call the File#exists
.
Hi @ruimo ,
I've fixed this and publish the 1.0.2-SNAPSHOT version on "Sonatype OSS Snapshots Repository". Please try it when you have a time!!
You should add maven repository setting and modify dependency version as follow:
repositories {
mavenCentral()
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" } // Add this line
}
dependencies {
// ...
implementation "org.mybatis.scripting:mybatis-thymeleaf:1.0.2-SNAPSHOT" // Modify this line
// ...
}
Also, I've fixed same issue on https://github.com/mybatis/freemarker-scripting .
It worked like a charm! Thank you for your support.
When I run MyBatis with Spring Boot, it fails to load SQL template file. It only occurs when I package application in a jar file (gradle bootJar). When I trace the application with debugger, it fails the SQL template file existence check (the exists() method Line 207 of TemplateFilePathProvider class). The code checks if the file actually exists. However, the SQL template file is in Jar file, so the check fails.
http://mybatis.org/freemarker-scripting/jacoco/org.mybatis.scripting.freemarker.support/TemplateFilePathProvider.java.html
MyBatis version
3.5.4 OpenJDK 1.8.0_202 SpringBoot 2.2.6 Ubuntu 18.04
Database vendor and version
h2 1.4.200
Test case or example project
https://github.com/ruimo/sqlfilenotfound
Steps to reproduce
Expected result
Actual result
Note
The bootRun become an expected result.