spring-projects / spring-data-jpa

Simplifies the development of creating a JPA-based data access layer.
https://spring.io/projects/spring-data-jpa/
Apache License 2.0
2.98k stars 1.41k forks source link

when user spring-data-jpa and spring-data-redis, INFO message Multiple Spring Data modules found, entering strict repository configuration mode always out put. #3250

Closed billschen closed 9 months ago

billschen commented 9 months ago

I use spring-data-jap and spring-data-redis in my spring boot project。 when run, console out put: RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode I dont want to use redis repository, I disable spring.data.redis.repositories.enabled in application.properties

spring.data.redis.repositories.enabled=false
spring.data.elasticsearch.repositories.enabled=false
spring.data.r2dbc.repositories.enabled=false
spring.data.jdbc.repositories.enabled=false
spring.data.ldap.repositories.enabled=false
spring.data.jpa.repositories.enabled=true

but info message Multiple Spring Data modules found, entering strict repository configuration mode out put also then I write a class implements CommandLineRunner to show which factory class loaded.

package com.guodi.checker.service;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.data.repository.core.support.RepositoryFactorySupport;
import org.springframework.core.io.ResourceLoader;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;
import org.springframework.util.StopWatch;

@Component
public class JpaTest implements CommandLineRunner{

    private final ResourceLoader resourceLoader;

    public JpaTest( ResourceLoader resourceLoader) {
        Assert.notNull(resourceLoader, "ResourceLoader must not be null");
        this.resourceLoader = resourceLoader;
    }

  @Override
  public void run(String... strings) throws Exception {

    var factorySupports = SpringFactoriesLoader
      .loadFactoryNames(RepositoryFactorySupport.class, resourceLoader.getClassLoader());
    System.out.print(STR."""
      resourceLoader=\{resourceLoader.toString()}  
      Loader.size =\{factorySupports.size()}  
      """);
    for( var factorySupport:factorySupports ){
            System.out.print(STR.""" 
                factorySupport:\{factorySupport}
            """);
    }
  }
}

out put :

resourceLoader=org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@169bb4dd, started on Fri Dec 01 10:35:33 CST 2023
Loader.size =3
    factorySupport:org.springframework.data.jpa.repository.support.JpaRepositoryFactory
    factorySupport:org.springframework.data.redis.repository.support.RedisRepositoryFactory
    factorySupport:org.springframework.data.keyvalue.repository.support.KeyValueRepositoryFactory

any other way to set use only JpaRepository? or I must ingore the INFO message. I notice when set spring.data.redis.repositories.enabled=false , message:

RepositoryConfigurationDelegate : Bootstrapping Spring Data Redis repositories in DEFAULT mode.

DON'T output so is it indecate that only Spring Data JPA Repositories used? I can ingore the info message oupt above.

schauder commented 9 months ago

You can ignore this info message.

When you have only a single Spring Data module on the class path any repository interface will be backed by an implementation of that module. When you have multiple Spring Data modules, Spring Data needs information what repository should be backed by which module. This typically happens through an annotation on the entity. Since JPA requires this annotation (the @Entity annotation) anyway and you are not intending to use Redis repositories nothing of relevance changes for you.

shivtrpm commented 9 months ago

@schauder @billschen I am still getting warnings for SPRING Classes. As you know that I cannot update SPRING Classes, what are the options do I have here. Check below WARNINGS

023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'jpa.named-queries#135' of type [org.springframework.data.repository.config.PropertiesBasedNamedQueriesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [commonBeanConfig]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'jpa.named-queries#135' of type [org.springframework.data.repository.core.support.PropertiesBasedNamedQueries] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [commonBeanConfig]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration' of type [org.springframework.cloud.commons.config.CommonsConfigAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'loadBalancerClientsDefaultsMappingsProvider' of type [org.springframework.cloud.client.loadbalancer.LoadBalancerDefaultMappingsProviderAutoConfiguration$$Lambda/0x000000700185b320] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'defaultsBindHandlerAdvisor' of type [org.springframework.cloud.commons.config.DefaultsBindHandlerAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration' of type [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'stringOrNumberMigrationVersionConverter' of type [org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$StringOrNumberToMigrationVersionConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'spring.datasource-org.springframework.boot.autoconfigure.jdbc.DataSourceProperties' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration' of type [org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$PooledDataSourceConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'jdbcConnectionDetails' of type [org.springframework.boot.autoconfigure.jdbc.PropertiesJdbcConnectionDetails] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:47 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'dataSource' of type [com.zaxxer.hikari.HikariDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'flyway' of type [org.flywaydb.core.Flyway] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.autoconfigure.sql.init.DataSourceInitializationConfiguration' of type [org.springframework.boot.autoconfigure.sql.init.DataSourceInitializationConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'spring.sql.init-org.springframework.boot.autoconfigure.sql.init.SqlInitializationProperties' of type [org.springframework.boot.autoconfigure.sql.init.SqlInitializationProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'dataSourceScriptDatabaseInitializer' of type [org.springframework.boot.autoconfigure.sql.init.SqlDataSourceScriptDatabaseInitializer] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration' of type [org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'inMemoryDatabaseShutdownExecutor' of type [org.springframework.boot.devtools.autoconfigure.DevToolsDataSourceAutoConfiguration$NonEmbeddedInMemoryDatabaseShutdownExecutor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'spring.jpa-org.springframework.boot.autoconfigure.orm.jpa.JpaProperties' of type [org.springframework.boot.autoconfigure.orm.jpa.JpaProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'spring.jpa.hibernate-org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties' of type [org.springframework.boot.autoconfigure.orm.jpa.HibernateProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration' of type [org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'hikariPoolDataSourceMetadataProvider' of type [org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration$$Lambda/0x00000070018a7d50] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration' of type [org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'jpaVendorAdapter' of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'entityManagerFactoryBuilder' of type [org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'persistenceManagedTypes' of type [org.springframework.orm.jpa.persistenceunit.SimplePersistenceManagedTypes] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.
2023-12-04 01:28:50 INFO  o.h.j.i.u.LogHelper:31 -  -  -  -  - HHH000204: Processing PersistenceUnitInfo [name: default]
2023-12-04 01:28:50 INFO  o.h.Version:44 -  -  -  -  - HHH000412: Hibernate ORM core version 6.3.1.Final
2023-12-04 01:28:50 INFO  o.h.c.i.RegionFactoryInitiator:50 -  -  -  -  - HHH000026: Second-level cache disabled
2023-12-04 01:28:50 INFO  o.s.o.j.p.SpringPersistenceUnitInfo:87 -  -  -  -  - No LoadTimeWeaver setup: ignoring JPA class transformer
2023-12-04 01:28:50 WARN  o.h.o.deprecation:152 -  -  -  -  - HHH90000025: MySQL8Dialect does not need to be specified explicitly using 'hibernate.dialect' (remove the property setting and it will be selected by default)
2023-12-04 01:28:50 WARN  o.h.o.deprecation:100 -  -  -  -  - HHH90000026: MySQL8Dialect has been deprecated; use org.hibernate.dialect.MySQLDialect instead
2023-12-04 01:28:51 WARN  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker:437 -  -  -  -  - Bean 'org.rpm365.api.enums.converter.AlertTimeRangeTypeConverter' of type [org.rpm365.api.enums.converter.AlertTimeRangeTypeConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying). Is this bean getting eagerly injected into a currently created BeanPostProcessor [nativeSQLLoaderCommonRepository.BillingReportRepositorySQL]? Check the corresponding BeanPostProcessor declaration and its dependencies.`

Additionally, my beans are Converters (AttributeConverter). I tried setting them as @Role(BeanDefinition.ROLE_INFRASTRUCTURE); But no help.

Please advise.