babyfish-ct / jimmer

A revolutionary ORM framework for both java and kotlin.
Apache License 2.0
725 stars 72 forks source link

Having issues with SqlClient while messing with Cache #383

Closed BlueWolfStorm closed 8 months ago

BlueWolfStorm commented 8 months ago

Hey there! It's me again :,) I bet you're getting tired of my newbie adventures *shedding tears in newbie. So, I'm trying to set up cache for my Kotlin project. I've got Redis up and running, added it to the application.properties, but... boom, hit with this error:

 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::                (v3.1.5)

2024-01-14T23:16:17.612-05:00  INFO 28924 --- [  restartedMain] c.w.b.BackendShoppingPageApplicationKt   : Starting BackendShoppingPageApplicationKt using Java 20.0.2.1 with PID 28924 (C:\Dev\WebPageAngularSpringBoot\backendShoppingPage\build\classes\kotlin\main started by jaide in C:\Dev\WebPageAngularSpringBoot\backendShoppingPage)
2024-01-14T23:16:17.617-05:00  INFO 28924 --- [  restartedMain] c.w.b.BackendShoppingPageApplicationKt   : No active profile set, falling back to 1 default profile: "default"
2024-01-14T23:16:17.711-05:00  INFO 28924 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2024-01-14T23:16:17.712-05:00  INFO 28924 --- [  restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2024-01-14T23:16:19.520-05:00  INFO 28924 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2024-01-14T23:16:19.523-05:00  INFO 28924 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Jimmer repositories in DEFAULT mode.
2024-01-14T23:16:19.986-05:00  INFO 28924 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 452 ms. Found 24 Jimmer repository interfaces.
2024-01-14T23:16:20.124-05:00  INFO 28924 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2024-01-14T23:16:20.126-05:00  INFO 28924 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.
2024-01-14T23:16:20.180-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.CategoryRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.181-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.CityRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.182-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.ColorRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.183-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.DepartmentRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.184-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.DocumentTypeRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.185-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.GenreRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.185-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.InfoChangeTypeRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.185-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.LoginHistoryRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.186-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.PaymentMethodRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.187-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.ProductImageRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.188-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.ProductRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.189-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.ProductSizeColorRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.190-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.PurchaseRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.191-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.PurchaseStatusRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.192-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.RoleRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.193-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.SecurityQuestionRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.194-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.ShoppingCarProductRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.195-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.ShoppingCarRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.195-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.SizeRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.196-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.SubCategoryRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.197-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.UserChangeHistoryRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.197-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.UserRatingRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.198-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.UserRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.199-05:00  INFO 28924 --- [  restartedMain] .RepositoryConfigurationExtensionSupport : Spring Data Redis - Could not safely identify store assignment for repository candidate interface com.wst.backendShoppingPage.Repositories.UserSecurityQuestionRepository; If you want this repository to be a Redis repository, consider annotating your entities with one of these annotations: org.springframework.data.redis.core.RedisHash (preferred), or consider extending one of the following types with your repository: org.springframework.data.keyvalue.repository.KeyValueRepository
2024-01-14T23:16:20.199-05:00  INFO 28924 --- [  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 52 ms. Found 0 Redis repository interfaces.
2024-01-14T23:16:21.159-05:00  INFO 28924 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2024-01-14T23:16:21.174-05:00  INFO 28924 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2024-01-14T23:16:21.175-05:00  INFO 28924 --- [  restartedMain] o.apache.catalina.core.StandardEngine    : Starting Servlet engine: [Apache Tomcat/10.1.15]
2024-01-14T23:16:21.258-05:00  INFO 28924 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2024-01-14T23:16:21.258-05:00  INFO 28924 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 3546 ms
2024-01-14T23:16:22.308-05:00  WARN 28924 --- [  restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'categoryService' defined in file [C:\Dev\WebPageAngularSpringBoot\backendShoppingPage\build\classes\kotlin\main\com\wst\backendShoppingPage\Services\CategoryService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'categoryRepository' defined in com.wst.backendShoppingPage.Repositories.CategoryRepository defined in @EnableJimmerRepositories declared on JimmerRepositoriesRegistrar.EnableJimmerRepositoriesConfiguration: Cannot resolve reference to bean 'sqlClient' while setting bean property 'sqlClient'
2024-01-14T23:16:22.327-05:00  INFO 28924 --- [  restartedMain] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2024-01-14T23:16:22.345-05:00  INFO 28924 --- [  restartedMain] .s.b.a.l.ConditionEvaluationReportLogger : 

Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
2024-01-14T23:16:22.377-05:00 ERROR 28924 --- [  restartedMain] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'categoryService' defined in file [C:\Dev\WebPageAngularSpringBoot\backendShoppingPage\build\classes\kotlin\main\com\wst\backendShoppingPage\Services\CategoryService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'categoryRepository' defined in com.wst.backendShoppingPage.Repositories.CategoryRepository defined in @EnableJimmerRepositories declared on JimmerRepositoriesRegistrar.EnableJimmerRepositoriesConfiguration: Cannot resolve reference to bean 'sqlClient' while setting bean property 'sqlClient'
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:801) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:240) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1352) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1189) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:950) ~[spring-context-6.0.13.jar:6.0.13]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:616) ~[spring-context-6.0.13.jar:6.0.13]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146) ~[spring-boot-3.1.5.jar:3.1.5]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:738) ~[spring-boot-3.1.5.jar:3.1.5]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:440) ~[spring-boot-3.1.5.jar:3.1.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-3.1.5.jar:3.1.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306) ~[spring-boot-3.1.5.jar:3.1.5]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295) ~[spring-boot-3.1.5.jar:3.1.5]
    at com.wst.backendShoppingPage.BackendShoppingPageApplicationKt.main(BackendShoppingPageApplication.kt:14) ~[main/:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
    at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:50) ~[spring-boot-devtools-3.1.5.jar:3.1.5]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoryRepository' defined in com.wst.backendShoppingPage.Repositories.CategoryRepository defined in @EnableJimmerRepositories declared on JimmerRepositoriesRegistrar.EnableJimmerRepositoriesConfiguration: Cannot resolve reference to bean 'sqlClient' while setting bean property 'sqlClient'
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:377) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:135) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1682) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:597) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:910) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:788) ~[spring-beans-6.0.13.jar:6.0.13]
    ... 22 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlClient' defined in class path resource [org/babyfish/jimmer/spring/cfg/SqlClientConfig.class]: Failed to instantiate [org.babyfish.jimmer.sql.kt.KSqlClient]: Factory method 'kotlinSqlClient' threw exception with message: com/github/benmanes/caffeine/cache/CacheLoader
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:654) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:642) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1332) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1162) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:365) ~[spring-beans-6.0.13.jar:6.0.13]
    ... 36 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.babyfish.jimmer.sql.kt.KSqlClient]: Factory method 'kotlinSqlClient' threw exception with message: com/github/benmanes/caffeine/cache/CacheLoader
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:171) ~[spring-beans-6.0.13.jar:6.0.13]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:650) ~[spring-beans-6.0.13.jar:6.0.13]
    ... 46 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/github/benmanes/caffeine/cache/CacheLoader
    at com.wst.backendShoppingPage.Cache.CacheConfig$cacheFactory$1.createObjectCache(CacheConfig.kt:34) ~[main/:na]
    at org.babyfish.jimmer.sql.cache.CacheConfig.build(CacheConfig.java:185) ~[jimmer-sql-0.8.44.jar:na]
    at org.babyfish.jimmer.sql.cache.CachesImpl.of(CachesImpl.java:180) ~[jimmer-sql-0.8.44.jar:na]
    at org.babyfish.jimmer.sql.JSqlClientImpl$BuilderImpl.build(JSqlClientImpl.java:1279) ~[jimmer-sql-0.8.44.jar:na]
    at org.babyfish.jimmer.sql.di.AbstractJSqlClientWrapper.sqlClient(AbstractJSqlClientWrapper.java:61) ~[jimmer-sql-0.8.44.jar:na]
    at org.babyfish.jimmer.sql.di.AbstractJSqlClientWrapper.getEntities(AbstractJSqlClientWrapper.java:119) ~[jimmer-sql-0.8.44.jar:na]
    at org.babyfish.jimmer.sql.kt.impl.KSqlClientImpl.<init>(KSqlClientImpl.kt:76) ~[jimmer-sql-kotlin-0.8.44.jar:na]
    at org.babyfish.jimmer.sql.kt.KSqlClientKt.toKSqlClient(KSqlClient.kt:167) ~[jimmer-sql-kotlin-0.8.44.jar:na]
    at org.babyfish.jimmer.spring.cfg.SqlClientConfig.kotlinSqlClient(SqlClientConfig.java:33) ~[jimmer-spring-boot-starter-0.8.44.jar:na]
    at org.babyfish.jimmer.spring.cfg.SqlClientConfig$$SpringCGLIB$$0.CGLIB$kotlinSqlClient$2(<generated>) ~[jimmer-spring-boot-starter-0.8.44.jar:na]
    at org.babyfish.jimmer.spring.cfg.SqlClientConfig$$SpringCGLIB$$FastClass$$1.invoke(<generated>) ~[jimmer-spring-boot-starter-0.8.44.jar:na]
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:258) ~[spring-core-6.0.13.jar:6.0.13]
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-6.0.13.jar:6.0.13]
    at org.babyfish.jimmer.spring.cfg.SqlClientConfig$$SpringCGLIB$$0.kotlinSqlClient(<generated>) ~[jimmer-spring-boot-starter-0.8.44.jar:na]
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:578) ~[na:na]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:139) ~[spring-beans-6.0.13.jar:6.0.13]
    ... 47 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.github.benmanes.caffeine.cache.CacheLoader
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
    ... 64 common frames omitted

Process finished with exit code 1

From what I gathered, it's pointing fingers at SqlClient, but I'm clueless on how to sort it out... Here's my code:

CacheConfig.kt

@ConditionalOnProperty("spring.data.redis.host")
@Configuration
class CacheConfig {
    @Bean
    fun cacheFactory(
        connectionFactory: RedisConnectionFactory,
        objectMapper: ObjectMapper
    ): KCacheFactory {
        val redisTemplate = RedisCaches.cacheRedisTemplate(connectionFactory)

        return object : AbstractKCacheFactory() {
            override fun createObjectCache(type: ImmutableType): Cache<*, *>? =
                ChainCacheBuilder<Any, Any>()
                    .add(CaffeineBinder(512, Duration.ofSeconds(1)))
                    .add(RedisValueBinder(redisTemplate, objectMapper, type, Duration.ofMinutes(10)))
                    .build()

            override fun createAssociatedIdCache(prop: ImmutableProp): Cache<*, *>? =
                createPropCache<Any, Any>(
                    filterState.isAffected(prop.targetType), // ❹
                    prop,
                    redisTemplate,
                    objectMapper,
                    Duration.ofMinutes(5)
                )

            override fun createAssociatedIdListCache(prop: ImmutableProp): Cache<*, List<*>>? =
                createPropCache<Any, List<*>>(
                    filterState.isAffected(prop.targetType), // ❻
                    prop,
                    redisTemplate,
                    objectMapper,
                    Duration.ofMinutes(5)
                )

            override fun createResolverCache(prop: ImmutableProp): Cache<*, *>? =
                createPropCache<Any, Any>(
                    filterState.isAffected(prop.targetType),
                    prop,
                    redisTemplate,
                    objectMapper,
                    Duration.ofMinutes(10)
                )
        }
    }

    companion object {
        @JvmStatic
        private fun <K, V> createPropCache(
            isMultiView: Boolean,
            prop: ImmutableProp,
            redisTemplate: RedisTemplate<String, ByteArray>,
            objectMapper: ObjectMapper,
            redisDuration: Duration
        ): Cache<K, V> {
            if (isMultiView) { // ❽
                return ChainCacheBuilder<K, V>()
                    .add(RedisHashBinder(redisTemplate, objectMapper, prop, redisDuration))
                    .build()
            }

            return ChainCacheBuilder<K, V>()
                .add(CaffeineBinder(512, Duration.ofSeconds(1)))
                .add(RedisValueBinder(redisTemplate, objectMapper, prop, redisDuration))
                .build()
        }
    }
}

CacheRepository.kt

interface CategoryRepository : KRepository<Category, Long> {
    fun findByName(name: String?, fetcher: Fetcher<Category>): List<Category> = sql.createQuery(Category::class) {
        where(table.name like "%${name}%")
        select(table.fetch(fetcher))
    }.execute()

    fun findInRange(start: Long, range: Long, defaultFetch: Fetcher<Category>): List<Category> =
        sql.createQuery(Category::class) {
            select(table.fetch(defaultFetch))
        }.limit(range.toInt(), start).execute()
}

Application.Properties

spring.datasource.url=MyCustomUrl
spring.datasource.username=MyCustomName
spring.datasource.password=MyCustomPassword

spring.data.redis.host=localhost
spring.data.redis.port=6379

jimmer.language = kotlin
jimmer.dialect = org.babyfish.jimmer.sql.dialect.MySqlDialect
jimmer.show-sql = true
jimmer.pretty-sql = true
jimmer.database-validation-mode = ERROR
jimmer.trigger-type = both

SpringBootApplication

@SpringBootApplication
class BackendShoppingPageApplication

fun main(args: Array<String>) {
    runApplication<BackendShoppingPageApplication>(*args)
}
BlueWolfStorm commented 8 months ago

I don't know why... but whenever I type here, I end up finding the issue after hours of searching. I really feel like crying right now. I didn't have the Caffeine library imported...

babyfish-ct commented 8 months ago

Please join the QQ user group 622853051 which is helpful