我正在尝试使用https://github.com/jdbi/jdbi-st4
这是我的文件夹结构
/dao
/src
/main
/java
/com.example.mysql
/Dao.java
/resources
/com.example.mysql
/Dao.sql.stg
我尝试了以下4
dbi.setStatementLocator(ST4StatementLocator.fromClasspath("src/main/resources/com/example/mysql/Dao.sql.stg"));
dbi.setStatementLocator(ST4StatementLocator.fromClasspath("/src/main/resources/com/example/mysql/Dao.sql.stg"));
dbi.setStatementLocator(ST4StatementLocator.fromClasspath("/com/example/mysql/Dao.sql.stg"));
dbi.setStatementLocator(ST4StatementLocator.fromClasspath("com/example/mysql/Dao.sql.stg"));
在所有4种情况下我都能得到
Exception in thread "main" java.lang.NullPointerException
at org.jdbi.v2.st4.ST4StatementLocator.forURL(ST4StatementLocator.java:110)
at org.jdbi.v2.st4.ST4StatementLocator.fromClasspath(ST4StatementLocator.java:77)
at org.jdbi.v2.st4.ST4StatementLocator.fromClasspath(ST4StatementLocator.java:67)
它无法解析我的查询文件的路径。感谢帮助