Skip to content

Commit

Permalink
fix: scan package name
Browse files Browse the repository at this point in the history
  • Loading branch information
cssxsh committed Jul 12, 2022
1 parent 664f03c commit 0ad3dc9
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ public interface MiraiHibernateLoader {
public constructor(plugin: JvmPlugin) : this(
autoScan = true,
packageName = with(plugin::class.java) {
classLoader.getDefinedPackage("$packageName.entry")?.name
?: classLoader.getDefinedPackage("$packageName.model")?.name
?: packageName
val packagePath = packageName.replace('.', '/')
for(name in listOf("entry", "entity", "entities", "model", "models", "bean", "beans", "dto")) {
classLoader.getResource("$packagePath/$name") ?: continue
return@with "$packageName.$name"
}
packageName
},
classLoader = plugin::class.java.classLoader,
configuration = plugin.configFolder.resolve("hibernate.properties"),
Expand Down

0 comments on commit 0ad3dc9

Please sign in to comment.