Skip to content

Upgrading to 2.2.0, enabling LDAP support will cause circular dependencies error #5051

@TomXiaoYZ

Description

@TomXiaoYZ
  • I have checked the discussions
  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Upgrading to portal 2.2.0.
  2. Enable LDAP support.
  3. Set spring.main.allow-circular-references=true

Expected behavior
Application should start normally.

Additional Details & Logs

Error Logs
OpenJDK 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.
OpenJDK 64-Bit Server VM warning: CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.
_ _ _
/ \ _ __ ___ | | | ___
/ _ \ | '_ \ / _ | | |/ _
/ ___ | |) | () | | | () |
/
/ _\ ./ _/|||___/
|_|

:: Spring Boot :: (v2.7.11)

2023-12-18 15:22:42.874 INFO 1 --- [ main] c.c.f.apollo.portal.PortalApplication : Starting PortalApplication v2.2.0 using Java 1.8.0_342 on apollo-portal-7cdb5f5f76-9jw5p with PID 1 (/apollo-portal/apollo-portal-2.2.0.jar started by root in /apollo-portal)
2023-12-18 15:22:42.877 INFO 1 --- [ main] c.c.f.apollo.portal.PortalApplication : The following 3 profiles are active: "github", "mysql", "ldap"
2023-12-18 15:22:44.473 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode
2023-12-18 15:22:44.476 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-12-18 15:22:44.636 INFO 1 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 148 ms. Found 16 JPA repository interfaces.
2023-12-18 15:22:45.066 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'httpMessageConverterConfiguration' of type [com.ctrip.framework.apollo.common.controller.HttpMessageConverterConfiguration$$EnhancerBySpringCGLIB$$3244aed] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.344 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'messageConverters' of type [com.ctrip.framework.apollo.common.controller.HttpMessageConverterConfiguration$1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.378 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#5ed731d0' of type [org.springframework.beans.factory.config.PropertiesFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.379 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#5ed731d0' of type [java.util.Properties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.379 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#62fe6067' 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)
2023-12-18 15:22:45.381 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#33e01298' of type [org.springframework.data.repository.core.support.RepositoryFragmentsFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.382 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#33e01298' of type [org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.384 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.385 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.406 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.435 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'dataSource' of type [com.zaxxer.hikari.HikariDataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.439 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.443 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.452 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.457 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.460 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.461 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'hikariPoolDataSourceMetadataProvider' of type [org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvidersConfiguration$HikariPoolDataSourceMetadataProviderConfiguration$$Lambda$465/1705665942] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:45.467 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.546 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.550 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : 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)
2023-12-18 15:22:45.565 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-12-18 15:22:45.814 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-12-18 15:22:45.907 INFO 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-12-18 15:22:45.992 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.15.Final
2023-12-18 15:22:46.312 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2023-12-18 15:22:46.490 INFO 1 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2023-12-18 15:22:46.616 WARN 1 --- [ main] org.hibernate.cfg.AnnotationBinder : HHH000503: A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for: com.ctrip.framework.apollo.common.entity.BaseEntity.
2023-12-18 15:22:46.718 WARN 1 --- [ main] org.hibernate.cfg.AnnotationBinder : HHH000503: A class should not be annotated with both @Inheritance and @MappedSuperclass. @Inheritance will be ignored for: com.ctrip.framework.apollo.audit.entity.BaseEntity.
2023-12-18 15:22:47.797 INFO 1 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-12-18 15:22:47.811 INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-12-18 15:22:47.815 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'entityManagerFactory' of type [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:47.816 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'entityManagerFactory' of type [com.sun.proxy.$Proxy133] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:47.841 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#4763c727' of type [com.sun.proxy.$Proxy134] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:47.861 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpaMappingContext' of type [org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:47.861 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'jpaMappingContext' of type [org.springframework.data.jpa.mapping.JpaMetamodelMappingContext] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.176 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'serverConfigRepository' of type [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.177 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'serverConfigRepository' of type [com.sun.proxy.$Proxy137] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.182 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'portalDBPropertySource' of type [com.ctrip.framework.apollo.portal.service.PortalDBPropertySource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.214 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration' of type [org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.221 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.transaction-org.springframework.boot.autoconfigure.transaction.TransactionProperties' of type [org.springframework.boot.autoconfigure.transaction.TransactionProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.222 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'platformTransactionManagerCustomizers' of type [org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizers] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.230 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'transactionManager' of type [org.springframework.orm.jpa.JpaTransactionManager] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : apollo.portal.envs = dev
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : organizations = [{"orgId":"TEST1","orgName":"样例部门1"},{"orgId":"TEST2","orgName":"样例部门2"}]. Old value = null
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : superAdmin = apollo. Old value = null
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : api.readTimeout = 10000. Old value = null
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : consumer.token.salt = someSalt. Old value = null
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : admin.createPrivateNamespace.switch = true. Old value = null
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : configView.memberOnly.envs = dev. Old value = null
2023-12-18 15:22:48.432 INFO 1 --- [ main] c.c.f.a.p.s.PortalDBPropertySource : Load config from DB : apollo.portal.meta.servers = {}. Old value = null
2023-12-18 15:22:48.434 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'portalConfig' of type [com.ctrip.framework.apollo.portal.component.config.PortalConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.440 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'apollo.audit.log-com.ctrip.framework.apollo.audit.ApolloAuditProperties' of type [com.ctrip.framework.apollo.audit.ApolloAuditProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.440 INFO 1 --- [ main] c.c.f.a.a.c.ApolloAuditAutoConfiguration : ApolloAuditAutoConfigure initializing...
2023-12-18 15:22:48.441 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.ctrip.framework.apollo.audit.configuration.ApolloAuditAutoConfiguration' of type [com.ctrip.framework.apollo.audit.configuration.ApolloAuditAutoConfiguration$$EnhancerBySpringCGLIB$$61ec165] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.454 INFO 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.ldap-com.ctrip.framework.apollo.portal.spi.configuration.LdapProperties' of type [com.ctrip.framework.apollo.portal.spi.configuration.LdapProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-12-18 15:22:48.455 WARN 1 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'restTemplateFactory' defined in URL [jar:file:/apollo-portal/apollo-portal-2.2.0.jar!/BOOT-INF/classes!/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apolloAuditHttpInterceptor' defined in class path resource [com/ctrip/framework/apollo/audit/configuration/ApolloAuditAutoConfiguration.class]: Unsatisfied dependency expressed through method 'apolloAuditHttpInterceptor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apolloAuditTraceContext' defined in class path resource [com/ctrip/framework/apollo/audit/configuration/ApolloAuditAutoConfiguration.class]: Unsatisfied dependency expressed through method 'apolloAuditTraceContext' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'apolloAuditOperatorPortalSupplier' defined in URL [jar:file:/apollo-portal/apollo-portal-2.2.0.jar!/BOOT-INF/classes!/com/ctrip/framework/apollo/portal/audit/ApolloAuditOperatorPortalSupplier.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'authConfiguration.SpringSecurityLDAPAuthAutoConfiguration' defined in URL [jar:file:/apollo-portal/apollo-portal-2.2.0.jar!/BOOT-INF/classes!/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration$SpringSecurityLDAPAuthAutoConfiguration.class]: Unsatisfied dependency expressed through constructor parameter 2; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'authConfiguration.SpringSecurityLDAPAuthAutoConfiguration': Requested bean is currently in creation: Is there an unresolvable circular reference?
2023-12-18 15:22:48.456 INFO 1 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2023-12-18 15:22:48.457 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2023-12-18 15:22:48.469 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2023-12-18 15:22:48.486 INFO 1 --- [ main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-12-18 15:22:48.529 ERROR 1 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

The dependencies of some of the beans in the application context form a cycle:

methodValidationPostProcessor defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]

restTemplateFactory defined in URL [jar:file:/apollo-portal/apollo-portal-2.2.0.jar!/BOOT-INF/classes!/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.class]

apolloAuditHttpInterceptor defined in class path resource [com/ctrip/framework/apollo/audit/configuration/ApolloAuditAutoConfiguration.class]

apolloAuditTraceContext defined in class path resource [com/ctrip/framework/apollo/audit/configuration/ApolloAuditAutoConfiguration.class]

apolloAuditOperatorPortalSupplier defined in URL [jar:file:/apollo-portal/apollo-portal-2.2.0.jar!/BOOT-INF/classes!/com/ctrip/framework/apollo/portal/audit/ApolloAuditOperatorPortalSupplier.class]
┌─────┐
| authConfiguration.SpringSecurityLDAPAuthAutoConfiguration defined in URL [jar:file:/apollo-portal/apollo-portal-2.2.0.jar!/BOOT-INF/classes!/com/ctrip/framework/apollo/portal/spi/configuration/AuthConfiguration$SpringSecurityLDAPAuthAutoConfiguration.class]
└─────┘

Action:

Despite circular references being allowed, the dependency cycle between beans could not be broken. Update your application to remove the dependency cycle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions