Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction - microservices

This question is extension of Working With Eureka Clients Programmatically issue - Completed shut down of DiscoveryClient. On my windows machine JAVA_HOME and PATH both versions where different. I just corrected it and now its showing me below error.
Error:
Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
I already went through the urls like :Error creating bean with name and Singleton bean creation not allowed and https://github.com/spring-cloud/spring-cloud-netflix/issues/1064, but these suggestions are not clear.
The complete error trace:
2018-12-28 19:44:02.188 INFO 22184 --- [ Thread-6] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#dc9876b: startup date [Fri Dec 28 19:43:59 IST 2018]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#6e20b53a
2018-12-28 19:44:02.188 INFO 22184 --- [ Thread-6] o.s.c.n.e.s.EurekaServiceRegistry : Unregistering application MYCLIENT with eureka with status DOWN
2018-12-28 19:44:02.188 WARN 22184 --- [ Thread-6] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1546006442188, current=DOWN, previous=UP]
2018-12-28 19:44:02.188 INFO 22184 --- [ Thread-6] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2018-12-28 19:44:02.190 INFO 22184 --- [ Thread-6] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2018-12-28 19:44:02.190 INFO 22184 --- [ Thread-6] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans
2018-12-28 19:44:02.192 INFO 22184 --- [ Thread-6] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2018-12-28 19:44:02.194 WARN 22184 --- [ Thread-6] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)

You simply need to add the web dependency. I am not clear why with the addition of web dependencies works/solves this issue.

Related

Factory method 'batchStubRunner' threw exception; nested exception is Assertion failed:

I am upgrading from spring-boot 2.1.13.RELEASE to 2.4.4.
After upgrading getting below errors in spring-cloud-contract testing, when running maven build.
Groovy version : 3.0.6
spring-cloud.version : Greenwich.SR6
wiremock.version : 2.27.2
spock.version : 2.0-M4-groovy-3.0
2021-05-14 15:51:01.471 WARN [test,,,] 8890 --- [ main] o.s.boot.StartupInfoLogger : InetAddress.getLocalHost().getHostName() took 5005 milliseconds to respond. Please verify your network configuration (macOS machines may need to add entries to /etc/hosts).
2021-05-14 15:51:06.477 INFO [test,,,] 8890 --- [ main] c.i.kea.web.contract.common.AddressSpec : Starting AddressSpec using Java 1.8.0_231 on pcusers-MacBook-Pro.local with PID 8890 (started by pcuser in /Users/pcuser/Workspace/branch/SR-1340/digital-investor-web-app)
2021-05-14 15:51:06.479 INFO [test,,,] 8890 --- [ main] c.i.kea.web.contract.common.AddressSpec : The following profiles are active: integrationtest,h2-test
2021-05-14 15:51:09.130 INFO [test,,,] 8890 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'com.ifds.kea.api.common.web.client.rewrite.UriCustomizerAutoConfiguration' of type [com.ifds.kea.api.common.web.client.rewrite.UriCustomizerAutoConfiguration$$EnhancerBySpringCGLIB$$a3e7890d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.172 INFO [test,,,] 8890 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#13803a94' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.199 INFO [test,,,] 8890 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.557 INFO [test,,,] 8890 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'stubrunner-org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties' of type [org.springframework.cloud.contract.stubrunner.spring.StubRunnerProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.561 INFO [test,,,] 8890 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration' of type [org.springframework.cloud.contract.stubrunner.spring.StubRunnerConfiguration$$EnhancerBySpringCGLIB$$211927d4] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-05-14 15:51:09.589 INFO [test,,,] 8890 --- [ main] o.s.c.c.s.AetherStubDownloaderBuilder : Will download stubs and contracts via Aether
2021-05-14 15:51:10.017 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Desired version is [+] - will try to resolve the latest version
2021-05-14 15:51:13.216 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Resolved version is [1.0.0-20210423062638352]
2021-05-14 15:51:15.125 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Resolved artifact [com.ifds.kea.api:kea-code-api:jar:stubs:1.0.0-20210423062638352] to /var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local294260021435503282/com/ifds/kea/api/kea-code-api/1.0.0-20210423062638352/kea-code-api-1.0.0-20210423062638352-stubs.jar
2021-05-14 15:51:15.127 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Unpacking stub from JAR [URI: file:/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local294260021435503282/com/ifds/kea/api/kea-code-api/1.0.0-20210423062638352/kea-code-api-1.0.0-20210423062638352-stubs.jar]
2021-05-14 15:51:15.144 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Unpacked file to [/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/contracts2633830323280917374]
2021-05-14 15:51:18.008 INFO [test,,,] 8890 --- [ main] o.s.c.c.s.AetherStubDownloaderBuilder : Will download stubs and contracts via Aether
2021-05-14 15:51:18.011 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Desired version is [+] - will try to resolve the latest version
2021-05-14 15:51:20.683 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Resolved version is [1.0.0-20210423050528085]
2021-05-14 15:51:24.328 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Resolved artifact [com.ifds.kea.api:kea-customer-api:jar:stubs:1.0.0-20210423050528085] to /var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local6763085284579893391/com/ifds/kea/api/kea-customer-api/1.0.0-20210423050528085/kea-customer-api-1.0.0-20210423050528085-stubs.jar
2021-05-14 15:51:24.329 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Unpacking stub from JAR [URI: file:/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/aether-local6763085284579893391/com/ifds/kea/api/kea-customer-api/1.0.0-20210423050528085/kea-customer-api-1.0.0-20210423050528085-stubs.jar]
2021-05-14 15:51:24.434 INFO [test,,,] 8890 --- [ main] o.s.c.c.stubrunner.AetherStubDownloader : Unpacked file to [/var/folders/cv/c0f5gc8d7x19ymj6y5ww85wc0000gn/T/contracts5025264596678888109]
2021-05-14 15:51:27.697 WARN [test,,,] 8890 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'batchStubRunnerBeanPostProcessor' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Unsatisfied dependency expressed through method 'batchStubRunnerBeanPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchStubRunner' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: Factory method 'batchStubRunner' threw exception; nested exception is Assertion failed:
assert value ==~ pattern.pattern
| | | |
| | | /api/v0/investors/[0-9]{8}/marketing-preferences
| | /api/v0/investors/[0-9]{8}/marketing-preferences
| false
'api/v0/investors/10035186/marketing-preferences'
2021-05-14 15:51:27.709 INFO [test,,,] 8890 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-05-14 15:51:27.753 WARN [test,,,] 8890 --- [ main] com.getsentry.raven.dsn.Dsn : Couldn't find a suitable DSN, defaulting to a Noop one.
2021-05-14 15:51:27.760 INFO [test,,,] 8890 --- [ main] com.getsentry.raven.DefaultRavenFactory : Using noop to send events.
2021-05-14 15:51:27.768 INFO [test,,,] 8890 --- [ main] com.getsentry.raven.Raven : Adding 'com.getsentry.raven.event.helper.HttpEventBuilderHelper#279afa4e' to the list of builder helpers.
2021-05-14 15:51:27.747 ERROR [test,,,] 8890 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'batchStubRunnerBeanPostProcessor' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Unsatisfied dependency expressed through method 'batchStubRunnerBeanPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchStubRunner' defined in class path resource [org/springframework/cloud/contract/stubrunner/spring/StubRunnerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.contract.stubrunner.BatchStubRunner]: Factory method 'batchStubRunner' threw exception; nested exception is Assertion failed:
assert value ==~ pattern.pattern
| | | |
| | | /api/v0/investors/[0-9]{8}/marketing-preferences
| | /api/v0/investors/[0-9]{8}/marketing-preferences
| false
'api/v0/investors/10035186/marketing-preferences'

Spring Boot WSDL SOAP web service application does not start

I am trying to start a WSDL-SOAP web service application but it doesn't start. Gives the below exception:
2020-11-30 22:28:12.521 INFO 97564 --- [ main] c.c.ws.soap.SpringBootApplicationRun : Starting SpringBootApplicationRun on Ramazans-MacBook-Pro.local with PID 97564 (started by rdemir in /Users/rdemir/Projects/METU/SM704/Project Phase 2)
2020-11-30 22:28:12.525 INFO 97564 --- [ main] c.c.ws.soap.SpringBootApplicationRun : No active profile set, falling back to default profiles: default
2020-11-30 22:28:13.304 INFO 97564 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.ws.config.annotation.DelegatingWsConfiguration' of type [org.springframework.ws.config.annotation.DelegatingWsConfiguration$$EnhancerBySpringCGLIB$$6d2d075b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2020-11-30 22:28:13.330 INFO 97564 --- [ main] .w.s.a.s.AnnotationActionEndpointMapping : Supporting [WS-Addressing August 2004, WS-Addressing 1.0]
2020-11-30 22:28:13.597 INFO 97564 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-11-30 22:28:13.623 INFO 97564 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-11-30 22:28:13.623 INFO 97564 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/9.0.13
2020-11-30 22:28:13.639 INFO 97564 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/rdemir/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
2020-11-30 22:28:13.757 INFO 97564 --- [ main] o.a.c.c.C.[.[localhost].[/wsdlfirstws] : Initializing Spring embedded WebApplicationContext
2020-11-30 22:28:13.758 INFO 97564 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1165 ms
2020-11-30 22:28:14.064 INFO 97564 --- [ main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {http://soap.ws.ckranz.com/}BankingServiceImplementationService from class com.banking.BankingPortType
2020-11-30 22:28:14.145 WARN 97564 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'endpoint' defined in class path resource [com/ckranz/ws/soap/config/WebServiceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.xml.ws.Endpoint]: Factory method 'endpoint' threw exception; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
2020-11-30 22:28:14.148 INFO 97564 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-11-30 22:28:14.158 INFO 97564 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-30 22:28:14.164 ERROR 97564 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'endpoint' defined in class path resource [com/ckranz/ws/soap/config/WebServiceConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.xml.ws.Endpoint]: Factory method 'endpoint' threw exception; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:627) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:456) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1288) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1127) ~[spring-beans-5.1.3.RELEASE.jar:5.1.3.RELEASE]
Here is some code:
https://www.codepile.net/pile/Ym773bm2

Field repository in com.App.Shopping.model.service.UserServiceImpl required a bean named 'entityManagerFactory' that could not be found

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \
\/ __)| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v2.3.3.RELEASE)
2020-08-30 18:09:53.081 INFO 4536 --- [ restartedMain] com.App.Shopping.ShoppingApplication : Starting ShoppingApplication on DESKTOP-DSCQJON with PID 4536 (D:\sarat\eclipse-workspace\Shopping.zip_expanded\Shopping\target\classes started by sarat in D:\sarat\eclipse-workspace\Shopping.zip_expanded\Shopping)
2020-08-30 18:09:53.081 INFO 4536 --- [ restartedMain] com.App.Shopping.ShoppingApplication : No active profile set, falling back to default profiles: default
2020-08-30 18:09:53.148 INFO 4536 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2020-08-30 18:09:53.151 INFO 4536 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 3ms. Found 1 JPA repository interfaces.
2020-08-30 18:09:53.256 INFO 4536 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8083 (http)
2020-08-30 18:09:53.256 INFO 4536 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-08-30 18:09:53.256 INFO 4536 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-08-30 18:09:53.325 INFO 4536 --- [ restartedMain] org.apache.jasper.servlet.TldScanner : At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2020-08-30 18:09:53.327 INFO 4536 --- [ restartedMain] o.a.c.c.C.[Tomcat-24].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-08-30 18:09:53.327 INFO 4536 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 244 ms
2020-08-30 18:09:53.339 WARN 4536 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shoppingController': Unsatisfied dependency expressed through field 'userservice'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userServiceImpl': Unsatisfied dependency expressed through field 'repository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userRepository' defined in com.App.Shopping.model.repository.UserRepository defined in #EnableJpaRepositories declared on ShoppingApplication: Cannot create inner bean '(inner bean)#71a2245c' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#71a2245c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' available
2020-08-30 18:09:53.340 INFO 4536 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-08-30 18:09:53.344 INFO 4536 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-08-30 18:09:53.400 ERROR 4536 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Field repository in com.App.Shopping.model.service.UserServiceImpl required a bean named 'entity manager factory' that could not be found.
The injection point has the following annotations:
- #org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean named 'entity manager factory' in your configuration.
I can see from stack trace that your entitymanagerfactory is not available.
Are you trying to autowire by name in your UserServiceImpl which means have you added Qualifier annotation ?

spring initialization hangs for few min

When starting Spring it will get hang for like 5 min
If you look at the log WebApplicationContext: initialization happens in 16:36
the next message is Initialized JPA EntityManagerFactory happens in 16:41 almost 5 min later
What could be the issue?
Thank you!
2019-05-09 16:36:59.619 INFO 18120 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 10419 ms
2019-05-09 16:41:18.196 INFO 18120 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'portal'
2019-05-09 16:41:18.362 INFO 18120 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-05-09 16:41:26.759 INFO 18120 --- [ restartedMain] s.s.l.DefaultSpringSecurityContextSource : URL 'ldap://ldap01:389', root DN is ''
2019-05-09 16:41:26.863 INFO 18120 --- [ restartedMain] .s.s.l.u.DefaultLdapAuthoritiesPopulator : groupSearchBase is empty. Searches will be performed from the context source base
2019-05-09 16:41:27.128 DEBUG 18120 --- [ restartedMain] com.xerox.printerfarm.config.SecurityConfig : secureEndPoints => /printers/**,/employees/user/**
2019-05-09 16:41:27.984 INFO 18120 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#6935ce05, org.springframework.security.web.context.SecurityContextPersistenceFilter#5c58f813, org.springframework.security.web.header.HeaderWriterFilter#54fe23e9, org.springframework.security.web.authentication.logout.LogoutFilter#1f81a1d8, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#43759aa7, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#40017880, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#60c590e1, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#64a8529a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#4cd90a9, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#6dd6807b, org.springframework.security.web.session.SessionManagementFilter#b218290, org.springframework.security.web.access.ExceptionTranslationFilter#b52b511, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#6d4bb1]
2019-05-09 16:41:28.354 INFO 18120 --- [ restartedMai
UPDATE
with some debug code from logger.org.springframework set to debug
2019-05-14 11:45:16.891 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'entityManagerFactoryBuilder'
2019-05-14 11:45:16.891 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'dataSource'
2019-05-14 11:45:16.995 DEBUG 22824 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'portal'
2019-05-14 11:45:18.665 DEBUG 22824 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:#devserv1:1521/DEV01SID]
2019-05-14 11:45:24.169 DEBUG 22824 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:#devserv1:1521/DEV01SID]
2019-05-14 11:45:24.703 DEBUG 22824 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:#devserv1:1521/DEV01SID]
2019-05-14 11:46:14.229 DEBUG 22824 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1557848774228 sessioncount 0
2019-05-14 11:46:14.229 DEBUG 22824 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 1 expired sessions: 0
---- 1 min here
2019-05-14 11:47:14.240 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1557848834240 sessioncount 0
2019-05-14 11:47:14.240 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0
---- 1 min here
2019-05-14 11:48:14.246 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1557848894246 sessioncount 0
2019-05-14 11:48:14.246 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0
---- 1 min here
2019-05-14 11:49:13.998 INFO 22824 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'portal'
2019-05-14 11:49:14.009 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'delegatingApplicationListener'
2019-05-14 11:49:14.018 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'liveReloadServerEventListener'
2019-05-14 11:49:14.019 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration$LiveReloadConfiguration'
2019-05-14 11:49:14.031 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'optionalLiveReloadServer'
2019-05-14 11:49:14.035 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties'
2019-05-14 11:49:14.043 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'liveReloadServer' via factory method to bean named 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties'
2019-05-14 11:49:14.071 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'optionalLiveReloadServer' via factory method to bean named 'liveReloadServer'
2019-05-14 11:49:14.083 DEBUG 22824 --- [ restartedMain] o.s.b.d.livereload.LiveReloadServer : Starting live reload server on port 35729

DSLContext bean takes several minutes to be created

After incorporating JOOQ into my Spring-Boot application, the internal Tomcat server boot time is more than 5 minutes!
I configured my application with JOOQ like documented on the Spring Boot documentation.
When I enable 'debug' logging you can notice it takes about 5 minutes for creating bean 'dslContext'. It seems that HikariCP is doing some stuff in the background for several minutes. This didn't happen before I configured JOOQ in my application.
Debug logging below:
21:04:59.292 [ main] DEBUG --- Creating shared instance of singleton bean 'dslContext'
21:04:59.292 [ main] DEBUG --- Creating instance of bean 'dslContext'
21:04:59.292 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.cache.config.internalCacheAdvisor'
21:04:59.292 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.retry.annotation.RetryConfiguration'
21:04:59.292 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
21:04:59.293 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.security.methodSecurityMetadataSourceAdvisor'
21:04:59.293 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration$DslContextConfiguration'
21:04:59.299 [ main] DEBUG --- Creating shared instance of singleton bean 'jooqConfiguration'
21:04:59.300 [ main] DEBUG --- Creating instance of bean 'jooqConfiguration'
21:04:59.300 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.cache.config.internalCacheAdvisor'
21:04:59.300 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.retry.annotation.RetryConfiguration'
21:04:59.300 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
21:04:59.300 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.security.methodSecurityMetadataSourceAdvisor'
21:04:59.301 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.boot.autoconfigure.jooq.JooqAutoConfiguration$DslContextConfiguration'
21:04:59.376 [ main] DEBUG --- Eagerly caching bean 'jooqConfiguration' to allow for resolving potential circular references
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.cache.config.internalCacheAdvisor'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.retry.annotation.RetryConfiguration'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.security.methodSecurityMetadataSourceAdvisor'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.cache.config.internalCacheAdvisor'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.retry.annotation.RetryConfiguration'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
21:04:59.386 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.security.methodSecurityMetadataSourceAdvisor'
21:04:59.551 [ main] DEBUG --- Finished creating instance of bean 'jooqConfiguration'
21:04:59.562 [ main] DEBUG --- Autowiring by type from bean name 'dslContext' via factory method to bean named 'jooqConfiguration'
21:04:59.942 [ main] DEBUG --- Eagerly caching bean 'dslContext' to allow for resolving potential circular references
21:05:00.023 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.cache.config.internalCacheAdvisor'
21:05:00.023 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.retry.annotation.RetryConfiguration'
21:05:00.023 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
21:05:00.027 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.security.methodSecurityMetadataSourceAdvisor'
21:05:00.027 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.cache.config.internalCacheAdvisor'
21:05:00.027 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.retry.annotation.RetryConfiguration'
21:05:00.027 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
21:05:00.027 [ main] DEBUG --- Returning cached instance of singleton bean 'org.springframework.security.methodSecurityMetadataSourceAdvisor'
21:05:20.109 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:05:50.113 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:06:20.114 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:06:50.116 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:07:13.126 [Engine[Tomcat]]] DEBUG --- Start expire sessions StandardManager at 1520539633101 sessioncount 0
21:07:13.128 [Engine[Tomcat]]] DEBUG --- End expire sessions StandardManager processingTime 27 expired sessions: 0
21:07:20.118 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:07:50.121 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:08:20.124 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:08:50.126 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:09:20.130 [iCP housekeeper] DEBUG --- SpringBootHikariCP - Pool stats (total=3, active=0, idle=3, waiting=0)
21:09:43.440 [ main] DEBUG --- Finished creating instance of bean 'dslContext'
Any ideas...?
After taking a thread dump it became clear that the problem is caused by aspectjweaver.
More info can be found here.
By excluding org.jooq in pointcut matching the problem is solved.

Resources