Остановить запуск весеннего загрузочного приложения до тех пор, пока весенний облачный сервер конфигурации не будет запущен

Я пытаюсь запустить свое весеннее загрузочное приложение со следующими наборами свойств, и я ожидаю, что оно будет повторять попытки загрузить свойства с сервера конфигурации 50 раз с ожиданием 6 секунд между любыми двумя попытками, и даже после этого он не может подключиться к серверу конфигурации, он должен либо возобновить запуск, либо выйти (мне безразлично, что весенняя загрузка способна делать после повторных попыток). Но не похоже, что он ведет себя так, как ожидалось.

Моя команда запуска -

java -jar -Dspring.application.name=maas-gateway -Dspring.cloud.config.uri=http://localhost:8888 -Dspring.cloud.config.failFast=false -Dspring.cloud.config.retry.initialInterval=5000 -Dspring.cloud.config.retry.maxInterval=7000 -Dspring.cloud.config.retry.maxAttempts=50 maas-gateway-1.0-SNAPSHOT.jar

Но я получаю следующие ошибки, так как он возобновляет запуск после одной попытки.

    2017-10-06 09:55:05.881  INFO [] 3598 --- [                main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@53e25b76: startup date [Fri Oct 06 09:55:05 EDT 2017]; root of context hierarchy
    2017-10-06 09:55:06.136  INFO [] 3598 --- [                main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
    2017-10-06 09:55:06.166  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'configurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bbc9d7cf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
      __  __              _____        _____       _
     |  \/  |            / ____|      / ____|     | |
     | \  / | __ _  __ _| (___ ______| |  __  __ _| |_ _____      ____ _ _   _
     | |\/| |/ _` |/ _` |\___ \______| | |_ |/ _` | __/ _ \ \ /\ / / _` | | | |
     | |  | | (_| | (_| |____) |     | |__| | (_| | ||  __/\ V  V / (_| | |_| |
     |_|  |_|\__,_|\__,_|_____/       \_____|\__,_|\__\___| \_/\_/ \__,_|\__, |
                                                                          __/ |
                                                                         |___/
    2017-10-06 09:55:06.494  INFO [] 3598 --- [                main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888
    2017-10-06 09:55:06.579  WARN [] 3598 --- [                main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/maas-gateway/default": Connection refused; nested exception is java.net.ConnectException: Connection refused
    2017-10-06 09:55:06.580  INFO [] 3598 --- [                main] com.solace.maas.Application              : No active profile set, falling back to default profiles: default
    2017-10-06 09:55:06.601  INFO [] 3598 --- [                main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2ed94a8b: startup date [Fri Oct 06 09:55:06 EDT 2017]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@53e25b76
    2017-10-06 09:55:08.889  INFO [] 3598 --- [                main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'getManagerExecutorService' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=gatewayServiceConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/gateway/configuration/GatewayServiceConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=iamServiceConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/iam/configuration/IamServiceConfiguration.class]]
    2017-10-06 09:55:08.890  INFO [] 3598 --- [                main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'getMaasProperties' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=gatewayServiceConfiguration; factoryMethodName=getMaasProperties; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/gateway/configuration/GatewayServiceConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=iamServiceConfiguration; factoryMethodName=getMaasProperties; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/iam/configuration/IamServiceConfiguration.class]]
    2017-10-06 09:55:08.898  INFO [] 3598 --- [                main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'getManagerExecutorService' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=iamServiceConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/iam/configuration/IamServiceConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=signupManagerConfiguration; factoryMethodName=getManagerExecutorService; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/solace/maas/signupManager/configuration/SignupManagerConfiguration.class]]
    2017-10-06 09:55:09.126  INFO [] 3598 --- [                main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'managementServletContext' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcHypermediaManagementContextConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcHypermediaManagementContextConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; factoryMethodName=managementServletContext; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.class]]
    2017-10-06 09:55:09.750  WARN [] 3598 --- [                main] o.s.c.a.ConfigurationClassPostProcessor  : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'.
    2017-10-06 09:55:09.992  INFO [] 3598 --- [                main] o.s.cloud.context.scope.GenericScope     : BeanFactory id=27bcc9d7-c3a9-3801-b696-3f3650ee7946
    2017-10-06 09:55:10.038  INFO [] 3598 --- [                main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
    2017-10-06 09:55:10.137  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport' of type [class org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$DefaultAsyncConfigurerSupport$$EnhancerBySpringCGLIB$$dcf17295] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.237  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$9fafd4d2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.467  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [class org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$385d9d0c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.486  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'objectPostProcessor' of type [class org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.494  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@736d6a5c' of type [class org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.506  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [class org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$5d323fbe] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.571  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [class org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.606  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration' of type [class org.springframework.cloud.netflix.metrics.MetricsInterceptorConfiguration$MetricsRestTemplateConfiguration$$EnhancerBySpringCGLIB$$d1dc7b13] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:10.659  INFO [] 3598 --- [                main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$bbc9d7cf] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2017-10-06 09:55:11.342  INFO [] 3598 --- [                main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
    2017-10-06 09:55:11.353  INFO [] 3598 --- [                main] o.apache.catalina.core.StandardService   : Starting service Tomcat
    2017-10-06 09:55:11.354  INFO [] 3598 --- [                main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.6
    2017-10-06 09:55:11.429  INFO [] 3598 --- [ocalhost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
    2017-10-06 09:55:11.429  INFO [] 3598 --- [ocalhost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 4828 ms
    2017-10-06 09:55:12.903 ERROR [] 3598 --- [ocalhost-startStop-1] o.s.b.c.embedded.tomcat.TomcatStarter    : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'iamServiceConfiguration': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter': Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration$$EnhancerBySpringCGLIB$$3067f332]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jacksonHttpMessageConverter' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.hateoas.mvc.TypeConstrainedMappingJackson2HttpMessageConverter]: Factory method 'jacksonHttpMessageConverter' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'config' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.config.RepositoryRestConfiguration]: Factory method 'config' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'repositories' defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.repository.support.Repositories]: Factory method 'repositories' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAttributeDAO': Cannot create inner bean '(inner bean)#60b53b0c' 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)#60b53b0c': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Tomcat.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.tomcat.jdbc.pool.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
    2017-10-06 09:55:12.932  WARN [] 3598 --- [                main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
    2017-10-06 09:55:12.940 ERROR [] 3598 --- [                main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Описание:

Невозможно определить класс драйвера встроенной базы данных для типа базы данных NONE

Действие:

Если вам нужна встроенная база данных, поместите поддерживаемую базу данных в путь к классам. Если у вас есть настройки базы данных, которые нужно загрузить из определенного профиля, вам может потребоваться активировать его (в настоящее время нет активных профилей).


person Chintan Barad    schedule 06.10.2017    source источник
comment
Можете показать файл сборки?   -  person pan    schedule 06.10.2017
comment
У вас есть spring-retry в качестве зависимости?   -  person spencergibb    schedule 06.10.2017
comment
Какую версию ты используешь?   -  person spencergibb    schedule 06.10.2017
comment
@spencergibb Спасибо за совет. Мне не хватало spring-retry как зависимости. После этого я получаю желаемое поведение.   -  person Chintan Barad    schedule 11.10.2017
comment
Добавлено как ответ   -  person spencergibb    schedule 11.10.2017


Ответы (1)


Добавьте spring-retry в качестве зависимости.

person spencergibb    schedule 11.10.2017