0

I am Currently facing the problem while running spring boot test.I have a spring boot project with vaadin and micro services configuration,When I run the test cases then behind the hood automatically some auto configurable classes are being loaded and the test take more amount of time to start and run.So is there any way I can avoid loading of the auto configurable classes so that I can quickly start my project.

My requirement is I must be able to get the Application context without loading the bunch of auto configurable classes.

I am using the just the two annotations above my class that is

@Runwith(SpringRunner.class) and @SpringbootTest

And I am getting the following things while running the test cases which I want to avoid is there any quick and short solution for excluding these things

2019-05-15 12:01:04.583 INFO [abc,,,] 11976 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at: http://localhost:8888 2019-05-15 12:01:05.789 WARN [abc,,,] 11976 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8888/abd/prod/master": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect 2019-05-15 12:01:05.804 INFO [abc,,,] 11976 --- [ main] com.abc.ui.view.login.LoginTest : The following profiles are active: prod 2019-05-15 12:01:05.820 INFO [abc,,,] 11976 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Refreshing org.springframework.web.context.support.GenericWebApplicationContext@91f565d: startup date [Wed May 15 12:01:05 IST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3c5dbdf8 2019-05-15 12:01:09.458 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'propertyPlaceholderConfigurer' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=propertyTestConfiguration; factoryMethodName=propertyPlaceholderConfigurer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/abc/ui/test/base/PropertyTestConfiguration.class]] with [Root bean: class [com.abc.ui.config.UIConfiguration]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=propertyPlaceholderConfigurer; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/abc/ui/config/UIConfiguration.class]] 2019-05-15 12:01:09.459 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'messageSource' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.vaadin.spring.i18n.config.I18NConfiguration; factoryMethodName=messageSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/vaadin/spring/i18n/config/I18NConfiguration.class]] with [Root bean: class [null]; scope=singleton; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=UIConfiguration; factoryMethodName=messageSource; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/abc/ui/config/UIConfiguration.class]] 2019-05-15 12:01:09.460 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'feignFormEncoder' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=multipartSupportConfig; factoryMethodName=feignFormEncoder; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/abc/ui/config/MultipartSupportConfig.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=fileManagementServiceProxy.MultipartSupportConfig; factoryMethodName=feignFormEncoder; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/abc/ui/services/filemanagement/FileManagementServiceProxy$MultipartSupportConfig.class]] 2019-05-15 12:01:09.572 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'WEBAPIGATEWAY.FeignClientSpecification' with a different definition: replacing [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 2019-05-15 12:01:09.573 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'WEBAPIGATEWAY.FeignClientSpecification' with a different definition: replacing [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 2019-05-15 12:01:09.578 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'WEBAPIGATEWAY.FeignClientSpecification' with a different definition: replacing [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 2019-05-15 12:01:09.579 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'WEBAPIGATEWAY.FeignClientSpecification' with a different definition: replacing [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 2019-05-15 12:01:09.589 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'WEBAPIGATEWAY.FeignClientSpecification' with a different definition: replacing [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 2019-05-15 12:01:09.589 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'WEBAPIGATEWAY.FeignClientSpecification' with a different definition: replacing [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.cloud.openfeign.FeignClientSpecification]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] 2019-05-15 12:01:10.294 INFO [abc,,,] 11976 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode! 2019-05-15 12:01:10.573 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'httpRequestHandlerAdapter' 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.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]] 2019-05-15 12:01:10.887 INFO [abc,,,] 11976 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'environmentWebEndpointExtension' 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.env.EnvironmentEndpointAutoConfiguration; factoryMethodName=environmentWebEndpointExtension; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/actuate/autoconfigure/env/EnvironmentEndpointAutoConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.autoconfigure.LifecycleMvcEndpointAutoConfiguration$EndpointConfiguration; factoryMethodName=environmentWebEndpointExtension; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/autoconfigure/LifecycleMvcEndpointAutoConfiguration$EndpointConfiguration.class]] 2019-05-15 12:01:11.542 WARN [abc,,,] 11976 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'com.vaadin.spring.VaadinConfiguration' 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'. 2019-05-15 12:01:12.098 INFO [abc,,,] 11976 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=532f1489-08d5-38dd-bf71-f959f522990c 2019-05-15 12:01:13.098 INFO [abc,,,] 11976 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2019-05-15 12:01:13.270 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'UIConfiguration' of type [com.abc.ui.config.UIConfiguration$$EnhancerBySpringCGLIB$$49f61c00] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:13.312 INFO [abc,,,] 11976 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'getAsyncExecutor' 2019-05-15 12:01:13.312 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'getAsyncExecutor' of type [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:13.798 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.annotation.SleuthAnnotationAutoConfiguration' of type [org.springframework.cloud.sleuth.annotation.SleuthAnnotationAutoConfiguration$$EnhancerBySpringCGLIB$$3442aec2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.265 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthAdvisorConfig' of type [org.springframework.cloud.sleuth.annotation.SleuthAdvisorConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.493 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$4df76b8d] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.524 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.log.SleuthLogAutoConfiguration$Slf4jConfiguration' of type [org.springframework.cloud.sleuth.log.SleuthLogAutoConfiguration$Slf4jConfiguration$$EnhancerBySpringCGLIB$$b8458f71] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.559 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration' of type [org.springframework.cloud.sleuth.instrument.web.client.feign.TraceFeignClientAutoConfiguration$FeignBeanPostProcessorConfiguration$$EnhancerBySpringCGLIB$$716f4156] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.841 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration' of type [org.springframework.cloud.sleuth.instrument.async.AsyncDefaultAutoConfiguration$$EnhancerBySpringCGLIB$$19c114af] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.908 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration' of type [org.springframework.cloud.sleuth.instrument.web.TraceWebServletAutoConfiguration$$EnhancerBySpringCGLIB$$f48bf0d6] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:14.974 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$RestTemplateConfig' of type [org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$RestTemplateConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.002 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.TraceHttpAutoConfiguration' of type [org.springframework.cloud.sleuth.instrument.web.TraceHttpAutoConfiguration$$EnhancerBySpringCGLIB$$185b71df] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.037 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration' of type [org.springframework.cloud.sleuth.autoconfig.TraceAutoConfiguration$$EnhancerBySpringCGLIB$$6ada85a3] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.114 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.boot.context.properties.ConversionServiceDeducer$Factory' of type [org.springframework.boot.context.properties.ConversionServiceDeducer$Factory] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.121 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.sleuth-org.springframework.cloud.sleuth.autoconfig.SleuthProperties' of type [org.springframework.cloud.sleuth.autoconfig.SleuthProperties] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.158 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthPropagation' of type [brave.propagation.B3Propagation$1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.191 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'slf4jSpanLogger' of type [org.springframework.cloud.sleuth.log.Slf4jCurrentTraceContext] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.208 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'noOpSpanReporter' of type [zipkin2.reporter.Reporter$1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.227 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthTraceSampler' of type [brave.sampler.Sampler$2] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.340 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthTracing' of type [brave.Tracing$Default] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.358 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'sleuthHttpTracing' of type [brave.http.AutoValue_HttpTracing] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.608 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'tracingClientHttpRequestInterceptor' of type [brave.spring.web.TracingClientHttpRequestInterceptor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.611 INFO [abc,,,] 11976 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$RestTemplateConfig$TraceInterceptorConfiguration' of type [org.springframework.cloud.sleuth.instrument.web.client.TraceWebClientAutoConfiguration$RestTemplateConfig$TraceInterceptorConfiguration$$EnhancerBySpringCGLIB$$32d296e1] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-05-15 12:01:15.968 INFO [abc,,,] 11976 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing FeignContext-WEBAPIGATEWAY: startup date [Wed May 15 12:01:15 IST 2019]; parent: org.springframework.web.context.support.GenericWebApplicationContext@91f565d 2019-05-15 12:01:15.995 INFO [abc,,,] 11976 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2019-05-15 12:01:17.756 INFO [abc,,,] 11976 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing FeignContext-COUNTRY-SERVICE: startup date [Wed May 15 12:01:17 IST 2019]; parent: org.springframework.web.context.support.GenericWebApplicationContext@91f565d 2019-05-15 12:01:17.782 INFO [abc,,,] 11976 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2019-05-15 12:01:20.605 INFO [abc,,,] 11976 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/chat/delete-conversation],methods=[DELETE]}" onto public void com.abc.ui.controller.ChatController.deleteConversation(com.telintel.services.conversationservice.integration.dtos.ConversationDTO) 2019-05-15 12:01:20.607 INFO [abc,,,] 11976 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/chat/push-conversation],methods=[POST]}" onto public void com.abc.ui.controller.ChatController.postConversation(com.telintel.services.conversationservice.integration.dtos.ConversationDTO) 2019-05-15 12:01:20.608 INFO [abc,,,] 11976 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/chat/push-message],methods=[PUT]}" onto public void 2019-05-15 12:01:21.501 INFO [abc,,,] 11976 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500} 2019-05-15 12:01:22.719 INFO [abc,,,] 11976 --- [localhost:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server localhost:27017

com.mongodb.MongoSocketOpenException: Exception opening socket at com.mongodb.connection.SocketStream.open(SocketStream.java:62) ~[mongodb-driver-core-3.6.3.jar:na] at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:126) ~[mongodb-driver-core-3.6.3.jar:na] at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:114) ~[mongodb-driver-core-3.6.3.jar:na] at java.lang.Thread.run(Unknown Source) [na:1.8.0_181] Caused by: java.net.ConnectException: Connection refused: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_181] at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_181] at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_181] at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_181] at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_181] at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_181] at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_181] at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_181] at com.mongodb.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:59) ~[mongodb-driver-core-3.6.3.jar:na] at com.mongodb.connection.SocketStream.open(SocketStream.java:57) ~[mongodb-driver-core-3.6.3.jar:na] ... 3 common frames omitted

2019-05-15 12:01:23.299 INFO [abc,,,] 11976 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname 2019-05-15 12:01:24.583 INFO [abc,,,] 11976 --- [ main] o.s.cloud.commons.util.InetUtils : Cannot determine local hostname 2019-05-15 12:01:26.112 INFO [abc,,,] 11976 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map) 2019-05-15 12:01:26.114 INFO [abc,,,] 11976 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map) 2019-05-15 12:01:26.116 INFO [abc,,,] 11976 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2019-05-15 12:01:27.151 INFO [abc,,,] 11976 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [public org.springframework.http.ResponseEntity springfox.documentation.swagger2.web.Swagger2Controller.getDocumentation(java.lang.String,javax.servlet.http.HttpServletRequest)] 2019-05-15 12:01:27.308 INFO [abc,,,] 11976 --- [ main] o.v.spring.i18n.CompositeMessageSource : Looking up MessageProviders 2019-05-15 12:01:27.323 INFO [abc,,,] 11976 --- [ main] o.v.spring.i18n.CompositeMessageSource : Found 1 MessageProvider(s) 2019-05-15 12:01:27.324 INFO [abc,,,] 11976 --- [ main] o.v.spring.i18n.CompositeMessageSource : MessageFormat cache enabled 2019-05-15 12:01:27.405 INFO [abc,,,] 11976 --- [ main] .s.i.MessageProviderCacheCleanupExecutor : Message provider cache cleanup is disabled [heartbeatInterval] = [300] 2019-05-15 12:01:30.233 INFO [abc,,,] 11976 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Set servlet init parameter [closeIdleSessions] = [false] 2019-05-15 12:01:30.278 INFO [abc,,,] 11976 --- [ main] c.v.s.b.i.VaadinServletConfiguration : Forwarding @SpringUI URLs from {/=org.springframework.web.servlet.mvc.ServletForwardingController@5d3b0f8a} 2019-05-15 12:01:30.285 INFO [abc,,,] 11976 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Root mapping to handler of type [class org.springframework.web.servlet.mvc.ServletForwardingController] 2019-05-15 12:01:31.108 INFO [abc,,,] 11976 --- [ main] o.s.d.r.w.RepositoryRestHandlerAdapter : Looking for @ControllerAdvice: org.springframework.web.context.support.GenericWebApplicationContext@91f565d: startup date [Wed May 15 12:01:05 IST 2019]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@3c5dbdf8 2019-05-15 12:01:31.186 INFO [abc,,,] 11976 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}/{id}],methods=[HEAD],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity org.springframework.data.rest.webmvc.RepositoryEntityController.headForItemResource(org.springframework.data.rest.webmvc.RootResourceInformation,java.io.Serializable,org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler) throws org.springframework.web.HttpRequestMethodNotSupportedException 2019-05-15 12:01:31.187 INFO [abc,,,] 11976 --- [ main] o.s.d.r.w.RepositoryRestHandlerMapping : Mapped "{[/{repository}],methods=[POST],produces=[application/hal+json || application/json]}" onto public org.springframework.http.ResponseEntity

kushal Baldev
  • 729
  • 1
  • 14
  • 37
  • You should only use `@SpringBootTest` if you want to run an integration test. If you want to test a single component don't use `@SpringBootTest` but just create the component, mock the depenencies and run the test. – M. Deinum May 15 '19 at 06:49
  • @M. Deinum I need the Application context which will not be available just by SpringbootTest as I have Enable I18N in my configuration class which I need to compare text and all. – kushal Baldev May 15 '19 at 07:56
  • Why? That is basically testing if Spring is working and not your own code. If you really want you could even create your own `ApplicationContext` with your subset. You don't have to use `@SpringBootTest`, because, as mentioned, that is for integration testing. – M. Deinum May 15 '19 at 08:03
  • please provide sample application if possible and explicit requirement what you need to achieve. https://stackoverflow.com/help/reprex – Dhruv May 16 '19 at 01:58

1 Answers1

0

You can use @EnableAutoConfiguration(exclude=SomeAutoConfiguration.class) in order to exclude some classes that you don't need to autoConfigure in your test environment.

More information you will find here.

Dina Bogdan
  • 4,345
  • 5
  • 27
  • 56
  • I have lots of configuration classes for micro services then It would be a long list of classes can you just mention that what classes I need to have as spring boot test case that only I can mention here or like similar of thing because excluding a long list of classes might be not a good solution. – kushal Baldev May 15 '19 at 06:27
  • I don't really understand what you want, but you should try to configure a BaseTestContext or something like that, where you exclude and include classes that you want and after that, create concrete TestCases that extends BaseTestContext. This is the way I'm working. – Dina Bogdan May 15 '19 at 07:55
  • the testCase runs fine but as I have provided some logs here I am using spring microservices, There are many Auto configurable classes which are in the springs list might be loading for the container but as we know we don't need any extra configurable classes where the topic comes to microservices and test case the only thing I need is I can run my test cases light weight without any extra loading of classes and neglecting a huge number of Auto configurable classes as my application is too large spring is taking much time to load the test cases. – kushal Baldev Jun 01 '19 at 10:18