我想使用 io.micronaut.data.repository.CrudRepository。在 IntelliJ 中,即使添加了依赖项,我也会抱怨:未解决的参考 CrudRepository
据我所见,我按照 Crudrepository 的预期添加了 io.micronaut.data:micronaut-data-hibernate-jpa
dependencies {
annotationProcessor("io.micronaut:micronaut-validation")
implementation("io.micronaut:micronaut-validation")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
implementation("io.micronaut:micronaut-runtime")
implementation("javax.annotation:javax.annotation-api")
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-management")
runtimeOnly("com.h2database:h2")
//https://micronaut-projects.github.io/micronaut-data/latest/guide/
annotationProcessor("io.micronaut.data:micronaut-data-processor:2.1.1")
implementation("io.micronaut.data:micronaut-data-hibernate-jpa:2.1.1")
//https://docs.micronaut.io/snapshot/guide/index.html#datavalidation
implementation("io.micronaut.beanvalidation:micronaut-hibernate-validator")
runtimeOnly("ch.qos.logback:logback-classic")
runtimeOnly("com.fasterxml.jackson.module:jackson-module-kotlin")
}
当我尝试启动应用程序时,我得到
C:\JDKs\jdk-11.0.6\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:51220,suspend=y,server=n -javaagent:C:\Users\Cast\AppData\Local\JetBrains\IdeaIC2020.2\groovyHotSwap\gragent.jar -javaagent:C:\Users\Cast\AppData\Local\JetBrains\IdeaIC2020.2\captureAgent\debugger-agent.jar -Dfile.encoding=UTF-8 -classpath "C:\_d\ZUP\WSs\demo\build\classes\kotlin\main;C:\_d\ZUP\WSs\demo\build\tmp\kapt3\classes\main;C:\_d\ZUP\WSs\demo\build\resources\main;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut.sql\micronaut-hibernate-jpa\3.1.1\fadbcbb16f62d31f29d4703fde11f06ecfaa494\micronaut-hibernate-jpa-3.1.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-validation\2.1.3\a9c9a65515166a54c69c2e149173b043b0a9587\micronaut-validation-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk8\1.4.10\998caa30623f73223194a8b657abd2baec4880ea\kotlin-stdlib-jdk8-1.4.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-reflect\1.4.10\e2b3c6695eee6085e606d96d685396dce23a3a06\kotlin-reflect-1.4.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut.kotlin\micronaut-kotlin-runtime\2.1.1\126f9ebc2fffaf6aea0520510141b2a3e244ea0e\micronaut-kotlin-runtime-2.1.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-http-client\2.1.3\345fb71a1bae80e181f23bcbe0774a29e43a516e\micronaut-http-client-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-management\2.1.3\29a0ab52ffc2f2b16e9414ec9c91d78183f4c171\micronaut-management-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-http-server-netty\2.1.3\551a62b0b2aa15209c5e4704cfc33147b77e5ee1\micronaut-http-server-netty-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-runtime\2.1.3\bc7dfb05dd0570ad4c23ea2f3ebd5241cefe0091\micronaut-runtime-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut.sql\micronaut-jdbc-hikari\3.1.1\2fe2d624384d9a2f1ee2891906618358969a3222\micronaut-jdbc-hikari-3.1.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-inject\2.1.3\ab588f5d7d6fd42e341e3741495d1c2c2135e51e\micronaut-inject-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\javax.annotation\javax.annotation-api\1.3.2\934c04d3cfef185a8008e7bf34331b79730a9d43\javax.annotation-api-1.3.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-aop\2.1.3\cdd7c896ccd5b7056642901596368ecedaf09f59\micronaut-aop-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut.sql\micronaut-jdbc\3.1.1\c42cab75e9fd7dea01a3be953111b51c57d48acb\micronaut-jdbc-3.1.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut.data\micronaut-data-tx-hibernate\2.1.1\e1e009726457d69200796446d0b327c8036d384d\micronaut-data-tx-hibernate-2.1.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.hibernate\hibernate-core\5.4.22.Final\3171ee075e69d4be3a39cbadcad9db3c2c0f2681\hibernate-core-5.4.22.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\jakarta.transaction\jakarta.transaction-api\1.3.3\c4179d48720a1e87202115fbed6089bdc4195405\jakarta.transaction-api-1.3.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-http\2.1.3\f603fce31199533f5453eb1f7b1f9db36088f2ac\micronaut-http-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.26\77100a62c2e6f04b53977b9f541044d7d722693d\slf4j-api-1.7.26.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\javax.validation\validation-api\2.0.1.Final\cb855558e6271b1b32e716d24cb85c7f583ce09e\validation-api-2.0.1.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-jdk7\1.4.10\30e46450b0bb3dbf43898d2f461be4a942784780\kotlin-stdlib-jdk7-1.4.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib\1.4.10\ea29e063d2bbe695be13e9d044dcfb0c7add398e\kotlin-stdlib-1.4.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-http-client-core\2.1.3\a8e3b44c8171bfb5fe034d54eb4b0231f06fa9c\micronaut-http-client-core-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-http-netty\2.1.3\a2e7ec804eff61c1f2194d6770a839388ec3ad3d\micronaut-http-netty-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-websocket\2.1.3\c9eb121a86ece2568dbc3ea9840cd775981074c3\micronaut-websocket-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.reactivex.rxjava2\rxjava\2.2.10\18e9edc67e0abaa03713eeb9ca2cb0e30c859de4\rxjava-2.2.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-handler-proxy\4.1.53.Final\24007d9b48de8694e62c0796e5e7bc51c1b0f369\netty-handler-proxy-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-router\2.1.3\ec6e57d1f04f0bb31d98a7edf921e6a2728bc9b\micronaut-router-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-http-server\2.1.3\804d8aedf98895826126e30ce4ab97bae462404a\micronaut-http-server-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-core\2.1.3\dd1bfa7a7bd4b4c875e6a0046690c98a4560a2f7\micronaut-core-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-http\4.1.53.Final\9f62cacb250ec65bdb368a178d2453535c365947\netty-codec-http-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jdk8\2.11.2\d4c1933a8d62db65c3d5a5cd809511e021a189c0\jackson-datatype-jdk8-2.11.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.datatype\jackson-datatype-jsr310\2.11.2\e6235e5eb3cf3edd2a95cd0dc96bc48aeb309e8a\jackson-datatype-jsr310-2.11.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-databind\2.11.2\ee08bbd8975dde844307fe8309dfcd5ec7ee129d\jackson-databind-2.11.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.zaxxer\HikariCP\3.4.5\aa1a2c00aae8e4ba8308e19940711bb9525b103d\HikariCP-3.4.5.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.26\a78a8747147d2c5807683e76ec2b633e95c14fe9\snakeyaml-1.26.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\javax.inject\javax.inject\1\6975da39a7040257bd51d21a231b76c915872d38\javax.inject-1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut.data\micronaut-data-tx\2.1.1\11f56278f9c412d86e21e6ac512644efa15b5b7b\micronaut-data-tx-2.1.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.hibernate.common\hibernate-commons-annotations\5.1.0.Final\700aeedc4a2089816621948f0379e17cbd17d5db\hibernate-commons-annotations-5.1.0.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jboss.logging\jboss-logging\3.3.2.Final\3789d00e859632e6c6206adc0c71625559e6e3b0\jboss-logging-3.3.2.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\javax.persistence\javax.persistence-api\2.2\25665ac8c0b62f50e6488173233239120fc52c96\javax.persistence-api-2.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\net.bytebuddy\byte-buddy\1.10.10\602a3da70f603752d3ce20a9997817d8dec39b51\byte-buddy-1.10.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\antlr\antlr\2.7.7\83cd2cd674a217ade95a4bb83a8a14f351f48bd0\antlr-2.7.7.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jboss\jandex\2.1.3.Final\cd56603e39eb1421560b71daa584348ecfd9e0b8\jandex-2.1.3.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml\classmate\1.5.1\3fe0bed568c62df5e89f4f174c101eab25345b6c\classmate-1.5.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\jaxb-runtime\2.3.1\dd6dda9da676a54c5b36ca2806ff95ee017d8738\jaxb-runtime-2.3.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\javax.xml.bind\jaxb-api\2.3.1\8531ad5ac454cc2deb9d4d32c40c4d7451939b5d\jaxb-api-2.3.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\javax.activation\javax.activation-api\1.2.0\85262acf3ca9816f9537ca47d5adeabaead7cb16\javax.activation-api-1.2.0.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.dom4j\dom4j\2.1.3\a75914155a9f5808963170ec20653668a2ffd2fd\dom4j-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-stdlib-common\1.4.10\6229be3465805c99db1142ad75e6c6ddeac0b04c\kotlin-stdlib-common-1.4.10.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jetbrains\annotations\13.0\919f0dfe192fb4e063e7dacadee7f8bb9a2672a9\annotations-13.0.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.micronaut\micronaut-buffer-netty\2.1.3\45947cbadff401250f170ec1757f2a5efca2c60c\micronaut-buffer-netty-2.1.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-http2\4.1.53.Final\97612c9c5b07cd7c7822542fa373b3263ccb8da0\netty-codec-http2-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-handler\4.1.53.Final\106846090e4bab23537d52da281616a001611e0c\netty-handler-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.reactivestreams\reactive-streams\1.0.3\d9fb7a7926ffa635b3dcaa5049fb2bfa25b3e7d0\reactive-streams-1.0.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec-socks\4.1.53.Final\669ea5cd9137c57d5b2dd71b11ed59adf1d70f85\netty-codec-socks-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-codec\4.1.53.Final\47aca7eb6f3a4ea623195906dd9caf3a1863e187\netty-codec-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-transport\4.1.53.Final\856f737f7c512f2e2b970df254f15fc558e991c\netty-transport-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-buffer\4.1.53.Final\a28d2694ff1bc95c627108b01949de3697b4c232\netty-buffer-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-common\4.1.53.Final\f5aac2cd268483ded1f76dacc5c9eb27899dee72\netty-common-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-core\2.11.2\bc022ab0f0c83c07f9c52c5ab9a6a4932b15cc35\jackson-core-2.11.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.core\jackson-annotations\2.11.2\e0a7f61fce3e3eac38a079c11831868269de2ea\jackson-annotations-2.11.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.glassfish.jaxb\txw2\2.3.1\a09d2c48d3285f206fafbffe0e50619284e92126\txw2-2.3.1.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.sun.istack\istack-commons-runtime\3.0.7\c197c86ceec7318b1284bffb49b54226ca774003\istack-commons-runtime-3.0.7.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\org.jvnet.staxex\stax-ex\1.8\8cc35f73da321c29973191f2cf143d29d26a1df7\stax-ex-1.8.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.sun.xml.fastinfoset\FastInfoset\1.2.15\bb7b7ec0379982b97c62cd17465cb6d9155f68e8\FastInfoset-1.2.15.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\io.netty\netty-resolver\4.1.53.Final\fe243ee1fddf47e3d54ec83d9f42ef35bcb5ac3e\netty-resolver-4.1.53.Final.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.2\25ea2e8b0c338a877313bd4672d3fe056ea78f0d\jsr305-3.0.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.fasterxml.jackson.module\jackson-module-kotlin\2.11.2\470e6cb1482e883ed006817bae7bb143ad75b8c0\jackson-module-kotlin-2.11.2.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.h2database\h2\1.4.199\7bf08152984ed8859740ae3f97fae6c72771ae45\h2-1.4.199.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.2.3\7c4f3c474fb2c041d8028740440937705ebb473a\logback-classic-1.2.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.typesafe\config\1.4.0\a8b341fe81552834edc231193afd6f56a96f0eff\config-1.4.0.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.2.3\864344400c3d4d92dfeb0a305dc87d953677c03c\logback-core-1.2.3.jar;C:\Users\Cast\.gradle\caches\modules-2\files-2.1\com.github.spotbugs\spotbugs-annotations\4.1.4\aa25ac7a3dab199133b1b49a8e79b152eeddd3a2\spotbugs-annotations-4.1.4.jar;C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.1\lib\idea_rt.jar" com.mybank.ApplicationKt
Connected to the target VM, address: '127.0.0.1:51220', transport: 'socket'
23:32:37.647 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
23:32:37.866 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
23:32:37.882 [main] INFO org.hibernate.Version - HHH000412: Hibernate ORM core version 5.4.22.Final
23:32:38.132 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [org.hibernate.SessionFactory] could not be loaded: Error instantiating bean of type [org.hibernate.boot.SessionFactoryBuilder]
Message: io/micronaut/data/model/DataType
Path Taken: SessionFactory.hibernateSessionFactory([SessionFactoryBuilder sessionFactoryBuilder]) --> SessionFactoryBuilder.hibernateSessionFactoryBuilder([MetadataSources metadataSources],ValidatorFactory validatorFactory)
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [org.hibernate.SessionFactory] could not be loaded: Error instantiating bean of type [org.hibernate.boot.SessionFactoryBuilder]
Message: io/micronaut/data/model/DataType
Path Taken: SessionFactory.hibernateSessionFactory([SessionFactoryBuilder sessionFactoryBuilder]) --> SessionFactoryBuilder.hibernateSessionFactoryBuilder([MetadataSources metadataSources],ValidatorFactory validatorFactory)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1549)
at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:220)
at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:2780)
at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:233)
at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:166)
at io.micronaut.runtime.Micronaut.start(Micronaut.java:64)
at com.mybank.ApplicationKt.main(Application.kt:8)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [org.hibernate.boot.SessionFactoryBuilder]
Message: io/micronaut/data/model/DataType
Path Taken: SessionFactory.hibernateSessionFactory([SessionFactoryBuilder sessionFactoryBuilder]) --> SessionFactoryBuilder.hibernateSessionFactoryBuilder([MetadataSources metadataSources],ValidatorFactory validatorFactory)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1925)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:2647)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2633)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2305)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2279)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1245)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:1013)
at io.micronaut.configuration.hibernate.jpa.$EntityManagerFactoryBean$HibernateSessionFactoryBuilder2Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:143)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1898)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:2647)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2633)
at io.micronaut.context.DefaultBeanContext.getBeanForDefinition(DefaultBeanContext.java:2305)
at io.micronaut.context.DefaultBeanContext.getBeanInternal(DefaultBeanContext.java:2279)
at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1245)
at io.micronaut.context.AbstractBeanDefinition.getBeanForConstructorArgument(AbstractBeanDefinition.java:1013)
at io.micronaut.configuration.hibernate.jpa.$EntityManagerFactoryBean$HibernateSessionFactory3Definition.build(Unknown Source)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:143)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1898)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingletonInternal(DefaultBeanContext.java:2647)
at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2633)
at io.micronaut.context.DefaultBeanContext.loadContextScopeBean(DefaultBeanContext.java:2172)
at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1543)
... 6 common frames omitted
Caused by: java.lang.NoClassDefFoundError: io/micronaut/data/model/DataType
at com.mybank.model.$AccountHolder$Introspection$$0.<init>(Unknown Source)
at com.mybank.model.$AccountHolder$Introspection.<init>(Unknown Source)
at com.mybank.model.$AccountHolder$IntrospectionRef.load(Unknown Source)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1675)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at io.micronaut.core.beans.DefaultBeanIntrospector.findIntrospections(DefaultBeanIntrospector.java:57)
at io.micronaut.core.beans.BeanIntrospector.findIntrospections(BeanIntrospector.java:83)
at io.micronaut.configuration.hibernate.jpa.JpaConfiguration$EntityScanConfiguration.findEntities(JpaConfiguration.java:297)
at io.micronaut.configuration.hibernate.jpa.EntityManagerFactoryBean.hibernateMetadataSources(EntityManagerFactoryBean.java:163)
at io.micronaut.configuration.hibernate.jpa.$EntityManagerFactoryBean$HibernateMetadataSources1Definition.doBuild(Unknown Source)
at io.micronaut.context.AbstractParametrizedBeanDefinition.build(AbstractParametrizedBeanDefinition.java:118)
at io.micronaut.context.BeanDefinitionDelegate.build(BeanDefinitionDelegate.java:139)
at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1898)
... 28 common frames omitted
Caused by: java.lang.ClassNotFoundException: io.micronaut.data.model.DataType
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 47 common frames omitted
Disconnected from the target VM, address: '127.0.0.1:51220', transport: 'socket'
Process finished with exit code 1
虽然我可以成功构建:
C:\demo>gradle clean build --stacktrace
> Task :kaptKotlin
Note: Creating bean classes for 6 type elements
> Task :kaptTestKotlin
Note: Creating bean classes for 1 type elements
BUILD SUCCESSFUL in 34s
21 actionable tasks: 21 executed
整个项目可以在git hub中找到