Swagger2 UI Resource mapping and API Documentation is missing - spring

This is a Spring Boot project.
I have added Spring Fox a Swagger 2 based API documentation tool to my .pom file and I have
configured it but for some reason (my guess is the resource mapping is not working properly)
The basic part of the confguration is there but when I have added more specific configuration,
like my contact or description of the API -> this part is not showing.
This is my Swagger configuration class:
#Component
#PropertySource("classpath:springFoxdocumentation.yml")
#EnableSwagger2
#EnableWebMvc
public class SpringFoxConfig implements WebMvcConfigurer {
#Value("${api.common.version}")
private static String apiVersion;
#Value("${api.common.title}")
private static String apiTitle;
#Value("${api.common.description}")
private static String apiDescription;
#Value("${api.common.termsOfServiceUrl}")
private static String apiTermsOfServiceUrl;
#Value("${api.common.license}")
private static String apiLicense;
#Value("${api.common.licenseUrl}")
private static String apiLicenseUrl;
#Value("${api.common.contact.name}")
private static String apiContactName;
#Value("${api.common.contact.url}")
private static String apiContactUrl;
#Value("${api.common.contact.email}")
private static String apiContactEmail;
#Bean
public Docket apiDocumentation(){
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.globalResponseMessage(RequestMethod.GET, Collections.emptyList())
.apiInfo(new ApiInfo(
apiVersion,
apiTitle,
apiDescription,
apiTermsOfServiceUrl,
new Contact( apiContactName, apiContactUrl,apiContactEmail),
apiLicense,
apiLicenseUrl,
Collections.emptyList()
));
}
#Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
}
}
I know that I shouldn't have there the resource handler method, but since I have assumed that this problem is caused by resource mapper I have added it int the code (but it didn't help)
And this is my .yml file under resources folder
api:
common:
version: 1.0.0
title: Ticket Manager
description: Ticket Manager server as a simple REST API for managing ticket and Incidents
termsOfServiceUrl: LINK FOR TERMS OF SERVICE
license: This is a Open Source Licensed product
licenseUrl: LINK FOR LICENSE URL
contact:
name: opensourcedev
url: URL FOR OPENSOURCEDEV
email: sample#gmail.com
And finally this is a log from my application when I launch swagger2 html page http://localhost:8080/swagger-ui.html#/
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.3.RELEASE)
2020-10-18 18:26:36.651 INFO 14928 --- [ main] c.o.t.TicketManagerApplication : Starting TicketManagerApplication on DESKTOP-FJ83RN4 with PID 14928 (D:\Git Projects\ticket-manager\target\classes started by sajmo in D:\Git Projects\ticket-manager)
2020-10-18 18:26:36.653 INFO 14928 --- [ main] c.o.t.TicketManagerApplication : No active profile set, falling back to default profiles: default
2020-10-18 18:26:37.378 INFO 14928 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2020-10-18 18:26:37.436 INFO 14928 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 51ms. Found 3 JPA repository interfaces.
2020-10-18 18:26:37.832 INFO 14928 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2020-10-18 18:26:37.840 INFO 14928 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-10-18 18:26:37.840 INFO 14928 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.37]
2020-10-18 18:26:37.962 INFO 14928 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-10-18 18:26:37.962 INFO 14928 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1258 ms
2020-10-18 18:26:38.063 INFO 14928 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2020-10-18 18:26:38.087 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiVersion
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiTitle
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiDescription
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiTermsOfServiceUrl
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiLicense
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiLicenseUrl
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiContactName
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiContactUrl
2020-10-18 18:26:38.088 INFO 14928 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : Autowired annotation is not supported on static fields: private static java.lang.String com.opensourcedev.ticketmanager.apidocs.SpringFoxConfig.apiContactEmail
2020-10-18 18:26:38.246 WARN 14928 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2020-10-18 18:26:38.273 INFO 14928 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2020-10-18 18:26:38.303 DEBUG 14928 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 17 mappings in 'requestMappingHandlerMapping'
2020-10-18 18:26:38.353 INFO 14928 --- [ main] pertySourcedRequestMappingHandlerMapping : Mapped URL path [/v2/api-docs] onto method [springfox.documentation.swagger2.web.Swagger2Controller#getDocumentation(String, HttpServletRequest)]
2020-10-18 18:26:38.373 DEBUG 14928 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/swagger-ui.html, /webjars/**] in 'resourceHandlerMapping'
2020-10-18 18:26:38.427 DEBUG 14928 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 #ModelAttribute, 0 #InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2020-10-18 18:26:38.448 DEBUG 14928 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 0 #ExceptionHandler, 1 ResponseBodyAdvice
2020-10-18 18:26:38.567 INFO 14928 --- [ task-1] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2020-10-18 18:26:38.587 INFO 14928 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2020-10-18 18:26:38.588 INFO 14928 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2020-10-18 18:26:38.602 INFO 14928 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2020-10-18 18:26:38.627 INFO 14928 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2020-10-18 18:26:38.753 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingDELETE_1
2020-10-18 18:26:38.770 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findAllTicketsUsingGET_1
2020-10-18 18:26:38.773 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findByIdUsingGET_1
2020-10-18 18:26:38.783 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: saveUsingPOST_1
2020-10-18 18:26:38.786 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingDELETE_2
2020-10-18 18:26:38.787 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingDELETE_3
2020-10-18 18:26:38.791 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findAllTicketsUsingGET_2
2020-10-18 18:26:38.792 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findAllTicketsUsingGET_3
2020-10-18 18:26:38.795 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findbyIdUsingGET_1
2020-10-18 18:26:38.800 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: saveUsingPOST_2
2020-10-18 18:26:38.801 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: saveUsingPOST_3
2020-10-18 18:26:38.803 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingDELETE_4
2020-10-18 18:26:38.804 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: deleteUsingDELETE_5
2020-10-18 18:26:38.809 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findAllTicketsUsingGET_4
2020-10-18 18:26:38.809 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findAllTicketsUsingGET_5
2020-10-18 18:26:38.812 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findbyIdUsingGET_2
2020-10-18 18:26:38.813 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: findbyIdUsingGET_3
2020-10-18 18:26:38.817 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: saveUsingPOST_4
2020-10-18 18:26:38.818 INFO 14928 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: saveUsingPOST_5
2020-10-18 18:26:38.826 INFO 14928 --- [ main] DeferredRepositoryInitializationListener : Triggering deferred initialization of Spring Data repositories…
2020-10-18 18:26:39.291 INFO 14928 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2020-10-18 18:26:39.428 INFO 14928 --- [ main] DeferredRepositoryInitializationListener : Spring Data repositories initialized!
2020-10-18 18:26:39.436 INFO 14928 --- [ main] c.o.t.TicketManagerApplication : Started TicketManagerApplication in 3.057 seconds (JVM running for 3.892)
2020-10-18 18:26:50.042 INFO 14928 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-10-18 18:26:50.042 INFO 14928 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2020-10-18 18:26:50.042 DEBUG 14928 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Detected StandardServletMultipartResolver
2020-10-18 18:26:50.047 DEBUG 14928 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : enableLoggingRequestDetails='false': request parameters and headers will be masked to prevent unsafe logging of potentially sensitive data
2020-10-18 18:26:50.047 INFO 14928 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 5 ms
2020-10-18 18:26:50.053 DEBUG 14928 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : GET "/v2/api-docs", parameters={}
2020-10-18 18:26:50.168 DEBUG 14928 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json;q=0.8', given [text/html, application/xhtml+xml, image/avif, image/webp, image/apng, application/xml;q=0.9, application/signed-exchange;v=b3;q=0.9, */*;q=0.8] and supported [application/json, application/*+json]
2020-10-18 18:26:50.169 DEBUG 14928 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.spring.web.json.Json#51a025e9]
2020-10-18 18:26:50.178 DEBUG 14928 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:27:24.254 DEBUG 14928 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : GET "/swagger-ui.html", parameters={}
2020-10-18 18:27:24.257 DEBUG 14928 --- [nio-8080-exec-2] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/"]
2020-10-18 18:27:24.262 DEBUG 14928 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed 304 NOT_MODIFIED
2020-10-18 18:27:24.391 DEBUG 14928 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : GET "/swagger-resources/configuration/ui", parameters={}
2020-10-18 18:27:24.392 DEBUG 14928 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to springfox.documentation.swagger.web.ApiResourceController#uiConfiguration()
2020-10-18 18:27:24.393 DEBUG 14928 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : GET "/webjars/springfox-swagger-ui/favicon-32x32.png?v=2.9.2", parameters={masked}
2020-10-18 18:27:24.394 DEBUG 14928 --- [nio-8080-exec-4] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to ResourceHttpRequestHandler ["classpath:/META-INF/resources/webjars/"]
2020-10-18 18:27:24.397 DEBUG 14928 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:27:24.398 DEBUG 14928 --- [nio-8080-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2020-10-18 18:27:24.398 DEBUG 14928 --- [nio-8080-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.swagger.web.UiConfiguration#674d67e1]
2020-10-18 18:27:24.400 DEBUG 14928 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:27:24.404 DEBUG 14928 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : GET "/swagger-resources/configuration/security", parameters={}
2020-10-18 18:27:24.404 DEBUG 14928 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to springfox.documentation.swagger.web.ApiResourceController#securityConfiguration()
2020-10-18 18:27:24.406 DEBUG 14928 --- [nio-8080-exec-5] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2020-10-18 18:27:24.406 DEBUG 14928 --- [nio-8080-exec-5] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.swagger.web.SecurityConfiguration#466a47c4]
2020-10-18 18:27:24.407 DEBUG 14928 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:27:24.410 DEBUG 14928 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : GET "/swagger-resources", parameters={}
2020-10-18 18:27:24.410 DEBUG 14928 --- [nio-8080-exec-6] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to springfox.documentation.swagger.web.ApiResourceController#swaggerResources()
2020-10-18 18:27:24.411 DEBUG 14928 --- [nio-8080-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2020-10-18 18:27:24.411 DEBUG 14928 --- [nio-8080-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [[springfox.documentation.swagger.web.SwaggerResource#592c2c2f]]
2020-10-18 18:27:24.413 DEBUG 14928 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:27:24.445 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : GET "/", parameters={}
2020-10-18 18:27:24.445 DEBUG 14928 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : GET "/v2/api-docs", parameters={}
2020-10-18 18:27:24.446 WARN 14928 --- [nio-8080-exec-8] o.s.web.servlet.PageNotFound : No mapping for GET /
2020-10-18 18:27:24.446 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2020-10-18 18:27:24.449 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
2020-10-18 18:27:24.450 DEBUG 14928 --- [nio-8080-exec-8] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2020-10-18 18:27:24.452 DEBUG 14928 --- [nio-8080-exec-8] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json]
2020-10-18 18:27:24.453 DEBUG 14928 --- [nio-8080-exec-8] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Sun Oct 18 18:27:24 CEST 2020, status=404, error=Not Found, message=, path=/}]
2020-10-18 18:27:24.454 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404
2020-10-18 18:27:24.458 DEBUG 14928 --- [nio-8080-exec-9] o.s.web.servlet.DispatcherServlet : GET "/csrf", parameters={}
2020-10-18 18:27:24.458 DEBUG 14928 --- [nio-8080-exec-7] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json, */*] and supported [application/json, application/*+json]
2020-10-18 18:27:24.458 DEBUG 14928 --- [nio-8080-exec-7] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.spring.web.json.Json#784dbf0b]
2020-10-18 18:27:24.458 WARN 14928 --- [nio-8080-exec-9] o.s.web.servlet.PageNotFound : No mapping for GET /csrf
2020-10-18 18:27:24.458 DEBUG 14928 --- [nio-8080-exec-9] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2020-10-18 18:27:24.458 DEBUG 14928 --- [nio-8080-exec-9] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
2020-10-18 18:27:24.459 DEBUG 14928 --- [nio-8080-exec-9] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2020-10-18 18:27:24.459 DEBUG 14928 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:27:24.459 DEBUG 14928 --- [nio-8080-exec-9] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json]
2020-10-18 18:27:24.459 DEBUG 14928 --- [nio-8080-exec-9] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Sun Oct 18 18:27:24 CEST 2020, status=404, error=Not Found, message=, path=/csrf}]
2020-10-18 18:27:24.460 DEBUG 14928 --- [nio-8080-exec-9] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404
2020-10-18 18:29:06.678 DEBUG 14928 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : GET "/swagger-resources/configuration/ui", parameters={}
2020-10-18 18:29:06.678 DEBUG 14928 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to springfox.documentation.swagger.web.ApiResourceController#uiConfiguration()
2020-10-18 18:29:06.679 DEBUG 14928 --- [nio-8080-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2020-10-18 18:29:06.679 DEBUG 14928 --- [nio-8080-exec-2] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.swagger.web.UiConfiguration#7fcb7c22]
2020-10-18 18:29:06.680 DEBUG 14928 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:29:06.684 DEBUG 14928 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : GET "/swagger-resources/configuration/security", parameters={}
2020-10-18 18:29:06.684 DEBUG 14928 --- [nio-8080-exec-4] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to springfox.documentation.swagger.web.ApiResourceController#securityConfiguration()
2020-10-18 18:29:06.685 DEBUG 14928 --- [nio-8080-exec-4] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2020-10-18 18:29:06.685 DEBUG 14928 --- [nio-8080-exec-4] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.swagger.web.SecurityConfiguration#5c5535f8]
2020-10-18 18:29:06.686 DEBUG 14928 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:29:06.689 DEBUG 14928 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : GET "/swagger-resources", parameters={}
2020-10-18 18:29:06.689 DEBUG 14928 --- [nio-8080-exec-3] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to springfox.documentation.swagger.web.ApiResourceController#swaggerResources()
2020-10-18 18:29:06.689 DEBUG 14928 --- [nio-8080-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json] and supported [application/json, application/*+json]
2020-10-18 18:29:06.690 DEBUG 14928 --- [nio-8080-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [[springfox.documentation.swagger.web.SwaggerResource#59507de0]]
2020-10-18 18:29:06.690 DEBUG 14928 --- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:29:06.719 DEBUG 14928 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : GET "/v2/api-docs", parameters={}
2020-10-18 18:29:06.720 DEBUG 14928 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : GET "/", parameters={}
2020-10-18 18:29:06.721 WARN 14928 --- [nio-8080-exec-6] o.s.web.servlet.PageNotFound : No mapping for GET /
2020-10-18 18:29:06.721 DEBUG 14928 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2020-10-18 18:29:06.721 DEBUG 14928 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
2020-10-18 18:29:06.721 DEBUG 14928 --- [nio-8080-exec-6] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2020-10-18 18:29:06.722 DEBUG 14928 --- [nio-8080-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json]
2020-10-18 18:29:06.722 DEBUG 14928 --- [nio-8080-exec-6] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Sun Oct 18 18:29:06 CEST 2020, status=404, error=Not Found, message=, path=/}]
2020-10-18 18:29:06.723 DEBUG 14928 --- [nio-8080-exec-6] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404
2020-10-18 18:29:06.726 DEBUG 14928 --- [nio-8080-exec-5] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [application/json, */*] and supported [application/json, application/*+json]
2020-10-18 18:29:06.726 DEBUG 14928 --- [nio-8080-exec-5] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [springfox.documentation.spring.web.json.Json#786c5618]
2020-10-18 18:29:06.727 DEBUG 14928 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-10-18 18:29:06.744 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : GET "/csrf", parameters={}
2020-10-18 18:29:06.745 WARN 14928 --- [nio-8080-exec-8] o.s.web.servlet.PageNotFound : No mapping for GET /csrf
2020-10-18 18:29:06.745 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : Completed 404 NOT_FOUND
2020-10-18 18:29:06.745 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : "ERROR" dispatch for GET "/error", parameters={}
2020-10-18 18:29:06.746 DEBUG 14928 --- [nio-8080-exec-8] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2020-10-18 18:29:06.746 DEBUG 14928 --- [nio-8080-exec-8] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json', given [*/*] and supported [application/json, application/*+json]
2020-10-18 18:29:06.746 DEBUG 14928 --- [nio-8080-exec-8] o.s.w.s.m.m.a.HttpEntityMethodProcessor : Writing [{timestamp=Sun Oct 18 18:29:06 CEST 2020, status=404, error=Not Found, message=, path=/csrf}]
2020-10-18 18:29:06.747 DEBUG 14928 --- [nio-8080-exec-8] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404

There are two issues in your code. First of all, #Value does not work on static fields. So all your springfox declared fields are null. Spring never set values in them.
If you remove the static from your fields , Spring will tell you that it doesn't find the properties like api.common.version or api.common.title. Because #PropertySource does not load yml files. It is declared in official documentation.
But there are workaround, you can follow this source here to use yml files with #PropertySource.

Related

Unable to fetch the view file

On making a GET Request which returns a ModelAndView Object I am getting the following error
: GET "/tweet2?email=tim#gmail.com", parameters={masked} 2022-03-08
11:04:45.459 DEBUG 46576 --- [nio-8080-exec-3]
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to
com.example.demo.RestAPIExample#getTweetsByEmail(String) 2022-03-08
11:04:45.464 DEBUG 46576 --- [nio-8080-exec-3]
o.s.w.s.v.ContentNegotiatingViewResolver : Selected '/' given [/]
2022-03-08 11:04:45.464 DEBUG 46576 --- [nio-8080-exec-3]
o.s.w.servlet.view.InternalResourceView : View name 'tweets', model
{tweets=[com.example.demo.Tweet#3a7a85cb]} 2022-03-08 11:04:45.465
DEBUG 46576 --- [nio-8080-exec-3]
o.s.w.servlet.view.InternalResourceView : Forwarding to [tweets]
2022-03-08 11:04:45.467 DEBUG 46576 --- [nio-8080-exec-3]
o.s.web.servlet.DispatcherServlet : "FORWARD" dispatch for GET
"/tweets?email=tim#gmail.com", parameters={masked} 2022-03-08
11:04:45.470 DEBUG 46576 --- [nio-8080-exec-3]
o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped to
ResourceHttpRequestHandler [classpath [META-INF/resources/], classpath
[resources/], classpath [static/], classpath [public/], ServletContext
[/]] 2022-03-08 11:04:45.472 DEBUG 46576 --- [nio-8080-exec-3]
o.s.w.s.r.ResourceHttpRequestHandler : Resource not found
2022-03-08 11:04:45.473 DEBUG 46576 --- [nio-8080-exec-3]
o.s.web.servlet.DispatcherServlet : Exiting from "FORWARD"
dispatch, status 404 2022-03-08 11:04:45.473 DEBUG 46576 ---
[nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Completed
404 NOT_FOUND 2022-03-08 11:04:45.474 DEBUG 46576 ---
[nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : "ERROR"
dispatch for GET "/error?email=tim#gmail.com", parameters={masked}
2022-03-08 11:04:45.475 DEBUG 46576 --- [nio-8080-exec-3]
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to
org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController#error(HttpServletRequest)
2022-03-08 11:04:45.482 DEBUG 46576 --- [nio-8080-exec-3]
o.s.w.s.m.m.a.HttpEntityMethodProcessor : Using 'application/json',
given [/] and supported [application/json, application/+json,
application/json, application/+json] 2022-03-08 11:04:45.483 DEBUG
46576 --- [nio-8080-exec-3] o.s.w.s.m.m.a.HttpEntityMethodProcessor :
Writing [{timestamp=Tue Mar 08 11:04:45 IST 2022, status=404,
error=Not Found, path=/tweet2}] 2022-03-08 11:04:45.497 DEBUG 46576
--- [nio-8080-exec-3] o.s.web.servlet.DispatcherServlet : Exiting from "ERROR" dispatch, status 404
Here is the code I wrote:
#GetMapping("/tweet2")
public ModelAndView getTweetsByEmail(#RequestParam String email) {
ModelAndView modelAndView = new ModelAndView("tweets");
List<Tweet> tweets = tweetMap.get(email);
modelAndView.getModel().put("tweets",tweets);
return modelAndView;
}
And there is a tweets.mustache file under the resources folder. Not sure why its unable to detect it

Springboot shutdown after two hours

Hi I have springboot running in linux server connecting to RDS oracle and its getting stopped after two hours for the below reason and we couldnt find out exact reason for the same:
2020-07-31 13:54:52.865 DEBUG 28836 --- [nio-8023-exec-7] m.m.a.RequestResponseBodyMethodProcessor : Using 'application/json', given [application/json, text/plain, */*] and supported [application/json, application/*+json, application/json, application/*+json, application/cbor]
2020-07-31 13:54:52.866 DEBUG 28836 --- [nio-8023-exec-7] m.m.a.RequestResponseBodyMethodProcessor : Writing [[SCM_COUNTERPARTY, SCM_ADMIN, FOX_SYSTEM, SCM_ENV, SCM_EXCEPTIONS, SCM_EDIT_FIELD, SCM_TRADE_STATE_R (truncated)...]
2020-07-31 13:54:52.885 DEBUG 28836 --- [nio-8023-exec-7] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-07-31 16:06:22.296 INFO 28836 --- [extShutdownHook] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2020-07-31 16:06:22.313 INFO 28836 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'

Spring Boot 2.1 MVC Logging

Upgrading Spring Boot 2.1.x from 2.0.x, not logging MVC mapping logs..
Spring Boot 2.0.x logs MVC Mapping at INFO level, it was very convinient and easily identifiable logs.
**Spring Boot 2.0.x**
2019-01-24 20:10:11.165 INFO [ main] s.w.s.m.m.a.RequestMappingHandlerMapping Mapped "{[/mapping2],methods=[GET]}" onto public java.lang.String com.test.controller.ControllerClass.method2()
2019-01-24 20:10:11.167 INFO [ main] s.w.s.m.m.a.RequestMappingHandlerMapping Mapped "{[/mapping1],methods=[GET]}" onto public java.lang.String com.test.controller.ControllerClass.method1()
As per Spring Boot 2.1.x documentation,
https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.1-Release-Notes#logging-refinements
There are no Info logs for MVC Mapping. Only summary logged as debug log.
We have to update level to TRACE to get more details.
**Spring Boot 2.0.x**
2019-01-24 20:16:08.549 TRACE 2516 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping :
c.t.c.ControllerClass:
{GET /mapping1}: method1()
{GET /mapping2}: method2()
2019-01-24 20:16:08.554 TRACE 2516 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping :
o.s.b.a.w.s.e.BasicErrorController:
{ /error}: error(HttpServletRequest)
{ /error, produces [text/html]}: errorHtml(HttpServletRequest,HttpServletResponse)
2019-01-24 20:16:08.560 DEBUG 2516 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 4 mappings in 'requestMappingHandlerMapping'
2019-01-24 20:16:08.584 DEBUG 2516 --- [ main] o.s.w.s.h.BeanNameUrlHandlerMapping : Detected 0 mappings in 'beanNameHandlerMapping'
By updating web log level to DEBUG or TRACE, We get more debug logs from Spring Web and they are not useful always. Unless, TRACE level, they are not much meaningful.
2019-01-24 20:39:59.767 TRACE 2516 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : GET "/mapping1", parameters={}, headers={masked} in DispatcherServlet 'dispatcherServlet'
2019-01-24 20:39:59.768 TRACE 2516 --- [nio-8080-exec-5] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped to public java.lang.String com.test.controller.ControllerClass.method1()
2019-01-24 20:39:59.769 TRACE 2516 --- [nio-8080-exec-5] .w.s.m.m.a.ServletInvocableHandlerMethod : Arguments: []
2019-01-24 20:39:59.771 DEBUG 2516 --- [nio-8080-exec-5] m.m.a.RequestResponseBodyMethodProcessor : Using 'text/html', given [text/html, application/xhtml+xml, image/webp, image/apng, application/xml;q=0.9, */*;q=0.8] and supported [text/plain, */*, text/plain, */*, application/json, application/*+json, application/json, application/*+json]
2019-01-24 20:39:59.771 TRACE 2516 --- [nio-8080-exec-5] m.m.a.RequestResponseBodyMethodProcessor : Writing ["Method1"]
2019-01-24 20:39:59.776 TRACE 2516 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : No view rendering, null ModelAndView returned.
2019-01-24 20:39:59.777 DEBUG 2516 --- [nio-8080-exec-5] o.s.web.servlet.DispatcherServlet : Completed 200 OK, headers={masked}
Is it possible to get Spring log information ? and How ?
From Spring Boot 2.1 version to get RequestMappingHandlerMapping log on console try add
logging.level.org.springframework.web=trace
on application.properties file
It worked for me

Spring Boot : Having a custom annotation on spring rest controller class causing error in identifying handler mapping

I am using a custom annotation called #Toggle on top of a rest controller class in spring boot to intercept the handlerType to block rest calls.
See below code snippet:
#RestController
#Toggle(feature="feature.foo")
#RequestMapping("/foo")
public class FooController {
#RequestMapping("")
public Map hello() {
return Collections.singletonMap("message", "hello foo!");
}
}
But I am not able to access the api which fails even before dispatcher servlet find the handler method.
2018-02-17 18:51:31.520 DEBUG 73947 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/foo]
2018-02-17 18:51:31.521 DEBUG 73947 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /foo
2018-02-17 18:51:31.523 DEBUG 73947 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Did not find handler method for [/foo]
2018-02-17 18:51:31.523 DEBUG 73947 --- [nio-8080-exec-2] o.s.w.s.handler.SimpleUrlHandlerMapping : Matching patterns for request [/foo] are [/**]
2018-02-17 18:51:31.523 DEBUG 73947 --- [nio-8080-exec-2] o.s.w.s.handler.SimpleUrlHandlerMapping : URI Template variables for request [/foo] are {}
2018-02-17 18:51:31.524 DEBUG 73947 --- [nio-8080-exec-2] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapping [/foo] to HandlerExecutionChain with handler [ResourceHttpRequestHandler [locations=[ServletContext resource [/], class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#333c8791]]] and 1 interceptor
2018-02-17 18:51:31.524 DEBUG 73947 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Last-Modified value for [/foo] is: -1
2018-02-17 18:51:31.525 DEBUG 73947 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
2018-02-17 18:51:31.525 DEBUG 73947 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Successfully completed request
2018-02-17 18:51:31.529 DEBUG 73947 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : DispatcherServlet with name 'dispatcherServlet' processing GET request for [/error]
2018-02-17 18:51:31.529 DEBUG 73947 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Looking up handler method for path /error
2018-02-17 18:51:31.529 DEBUG 73947 --- [nio-8080-exec-2] s.w.s.m.m.a.RequestMappingHandlerMapping : Returning handler method [public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)]
2018-02-17 18:51:31.530 DEBUG 73947 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Last-Modified value for [/error] is: -1
Found below logs which can throw some more light on the problem.
2018-02-17 20:30:24.172 DEBUG 94537 --- [ main] .i.s.PathMatchingResourcePatternResolver : Resolved location pattern [classpath*:in/karthick/spring/**/*.class] to resources [file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/AppConfig.class], file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/Constants.class], file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/FeatureToggleApplication.class], file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/web/FooController.class], file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/web/HelloController.class]]
2018-02-17 20:30:24.172 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Scanning file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/AppConfig.class]
2018-02-17 20:30:24.190 DEBUG 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Identified candidate component class: file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/AppConfig.class]
2018-02-17 20:30:24.191 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Scanning file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/Constants.class]
2018-02-17 20:30:24.191 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Ignored because not matching any filter: file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/Constants.class]
2018-02-17 20:30:24.191 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Scanning file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/FeatureToggleApplication.class]
2018-02-17 20:30:24.196 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Ignored because not matching any filter: file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/FeatureToggleApplication.class]
2018-02-17 20:30:24.196 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Scanning file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/web/FooController.class]
2018-02-17 20:30:24.205 TRACE 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'feature.foo' in [servletConfigInitParams]
2018-02-17 20:30:24.205 TRACE 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'feature.foo' in [servletContextInitParams]
2018-02-17 20:30:24.205 TRACE 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'feature.foo' in [systemProperties]
2018-02-17 20:30:24.206 TRACE 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'feature.foo' in [systemEnvironment]
2018-02-17 20:30:24.206 TRACE 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'feature.foo' in [random]
2018-02-17 20:30:24.206 TRACE 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'feature.foo' in [applicationConfigurationProperties]
2018-02-17 20:30:24.206 DEBUG 94537 --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Could not find key 'feature.foo' in any property source
2018-02-17 20:30:24.210 TRACE 94537 --- [ main] o.s.c.a.ClassPathBeanDefinitionScanner : Ignored because not matching any filter: file [/Users/karthick/feature-toggles/target/classes/in/karthick/spring/web/FooController.class]
However, if I use the same #Toggle annotation on a method inside rest controller class, the handler mapping finds the right method to invoke.
#RequestMapping("/foo")
#Toggle(feature = "feature.foo")
public Map hello() {
return Collections.singletonMap("message", "hello foo!");
}
How can I make sure spring boot maps to right handler method even if I use custom annotation on top of rest controller.

How to automatically initizlize the 'dispatcherServlet' the moment after the web app started in the spring boot application?

I am working on feign client with hystrix in a spring boot application. I started a eureka server and register two providers. In the feign client application I added the hystrix support. And when I request the service first time, I got the hystrix result, but after that every request could get the expected result from the provider. From the log, I see that the dispatcherServlet was lazily initialized after the first requested was made, not after the web app started. And this extends the timeout span of the hystrix. In this case, I always get the false result on the first request because of the lazy initialization of dispatcherServlet.
How could I get the first request correctly?
Is it ok to initialize
the dispatcherServet the moment after the web starts? If so,
how can I do it?
log:
:: Spring Boot :: (v1.4.0.RELEASE)
2016-10-13 15:06:03.677 INFO 41459 --- [ main] c.i.c.s.MovieFeignHystrixApplication : No active profile set, falling back to default profiles: default
2016-10-13 15:06:03.723 INFO 41459 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e6a5539: startup date [Thu Oct 13 15:06:03 CST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#6e509ffa
2016-10-13 15:06:05.005 INFO 41459 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'hystrixFeature' 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.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration$HystrixWebConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration$HystrixWebConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.cloud.netflix.hystrix.HystrixCircuitBreakerConfiguration; factoryMethodName=hystrixFeature; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/cloud/netflix/hystrix/HystrixCircuitBreakerConfiguration.class]]
2016-10-13 15:06:05.431 WARN 41459 --- [ 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'.
2016-10-13 15:06:05.705 INFO 41459 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=cc11fab8-4eec-3228-9e14-ac8a7dca16b2
2016-10-13 15:06:05.730 INFO 41459 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-10-13 15:06:06.367 INFO 41459 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$76aeae65] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2016-10-13 15:06:07.056 INFO 41459 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8022 (http)
2016-10-13 15:06:07.078 INFO 41459 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat
2016-10-13 15:06:07.079 INFO 41459 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.4
2016-10-13 15:06:07.266 INFO 41459 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2016-10-13 15:06:07.267 INFO 41459 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3544 ms
2016-10-13 15:06:07.883 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/]
2016-10-13 15:06:07.902 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'metricFilter' to: [/*]
2016-10-13 15:06:07.903 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*]
2016-10-13 15:06:07.903 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2016-10-13 15:06:07.903 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2016-10-13 15:06:07.903 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*]
2016-10-13 15:06:07.903 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2016-10-13 15:06:07.904 INFO 41459 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*]
2016-10-13 15:06:08.071 INFO 41459 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#140d1230: startup date [Thu Oct 13 15:06:08 CST 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e6a5539
2016-10-13 15:06:08.111 INFO 41459 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-10-13 15:06:09.841 WARN 41459 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2016-10-13 15:06:09.842 INFO 41459 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-10-13 15:06:09.857 INFO 41459 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration#631cb129
2016-10-13 15:06:10.026 INFO 41459 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e6a5539: startup date [Thu Oct 13 15:06:03 CST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext#6e509ffa
2016-10-13 15:06:10.240 INFO 41459 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/feign/{id}],methods=[GET]}" onto public com.itmuch.cloud.study.user.entity.User com.itmuch.cloud.study.user.controller.FeignHystrixController.findByIdFeign(java.lang.Long)
2016-10-13 15:06:10.244 INFO 41459 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2016-10-13 15:06:10.245 INFO 41459 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2016-10-13 15:06:10.383 INFO 41459 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-10-13 15:06:10.383 INFO 41459 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-10-13 15:06:10.468 INFO 41459 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2016-10-13 15:06:11.460 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2016-10-13 15:06:11.461 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env || /env.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.462 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/hystrix.stream/**]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.cloud.netflix.endpoint.ServletWrappingEndpoint.handle(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.lang.Exception
2016-10-13 15:06:11.464 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.467 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.467 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/refresh || /refresh.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-10-13 15:06:11.468 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/resume || /resume.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-10-13 15:06:11.470 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/pause || /pause.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.endpoint.GenericPostableMvcEndpoint.invoke()
2016-10-13 15:06:11.471 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.474 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2016-10-13 15:06:11.475 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/health || /health.json],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(java.security.Principal)
2016-10-13 15:06:11.476 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/info || /info.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.479 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/restart || /restart.json],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.context.restart.RestartMvcEndpoint.invoke()
2016-10-13 15:06:11.480 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2016-10-13 15:06:11.480 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.506 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.529 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/archaius || /archaius.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.562 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.563 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env],methods=[POST]}" onto public java.lang.Object org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.value(java.util.Map<java.lang.String, java.lang.String>)
2016-10-13 15:06:11.566 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/env/reset],methods=[POST]}" onto public java.util.Map<java.lang.String, java.lang.Object> org.springframework.cloud.context.environment.EnvironmentManagerMvcEndpoint.reset()
2016-10-13 15:06:11.580 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/features || /features.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.581 INFO 41459 --- [ main] o.s.b.a.e.mvc.EndpointHandlerMapping : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2016-10-13 15:06:11.911 WARN 41459 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
2016-10-13 15:06:11.911 INFO 41459 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2016-10-13 15:06:12.096 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2016-10-13 15:06:12.118 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'refreshScope' has been autodetected for JMX exposure
2016-10-13 15:06:12.122 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'environmentManager' has been autodetected for JMX exposure
2016-10-13 15:06:12.129 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'configurationPropertiesRebinder' has been autodetected for JMX exposure
2016-10-13 15:06:12.132 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'refreshEndpoint' has been autodetected for JMX exposure
2016-10-13 15:06:12.134 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'restartEndpoint' has been autodetected for JMX exposure
2016-10-13 15:06:12.139 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'environmentManager': registering with JMX server as MBean [org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager]
2016-10-13 15:06:12.373 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'restartEndpoint': registering with JMX server as MBean [org.springframework.cloud.context.restart:name=restartEndpoint,type=RestartEndpoint]
2016-10-13 15:06:12.394 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshScope': registering with JMX server as MBean [org.springframework.cloud.context.scope.refresh:name=refreshScope,type=RefreshScope]
2016-10-13 15:06:12.412 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'configurationPropertiesRebinder': registering with JMX server as MBean [org.springframework.cloud.context.properties:name=configurationPropertiesRebinder,context=2e6a5539,type=ConfigurationPropertiesRebinder]
2016-10-13 15:06:12.427 INFO 41459 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'refreshEndpoint': registering with JMX server as MBean [org.springframework.cloud.endpoint:name=refreshEndpoint,type=RefreshEndpoint]
2016-10-13 15:06:12.720 INFO 41459 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
2016-10-13 15:06:12.741 INFO 41459 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING
2016-10-13 15:06:13.225 INFO 41459 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson
2016-10-13 15:06:13.228 INFO 41459 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson
2016-10-13 15:06:13.462 INFO 41459 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml
2016-10-13 15:06:13.462 INFO 41459 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml
2016-10-13 15:06:13.838 INFO 41459 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration
2016-10-13 15:06:13.892 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false
2016-10-13 15:06:13.892 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null
2016-10-13 15:06:13.892 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false
2016-10-13 15:06:13.892 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false
2016-10-13 15:06:13.892 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true
2016-10-13 15:06:13.893 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true
2016-10-13 15:06:13.893 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server
2016-10-13 15:06:14.350 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : The response status is 200
2016-10-13 15:06:14.353 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Starting heartbeat executor: renew interval is: 30
2016-10-13 15:06:14.356 INFO 41459 --- [ main] c.n.discovery.InstanceInfoReplicator : InstanceInfoReplicator onDemand update allowed rate per min is 4
2016-10-13 15:06:14.362 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1476342374362 with initial instances count: 3
2016-10-13 15:06:14.477 INFO 41459 --- [ main] c.n.e.EurekaDiscoveryClientConfiguration : Registering application microservice-consumer-movie-feign-with-hystrix-stream with eureka with status UP
2016-10-13 15:06:14.478 INFO 41459 --- [ main] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1476342374477, current=UP, previous=STARTING]
2016-10-13 15:06:14.479 INFO 41459 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MICROSERVICE-CONSUMER-MOVIE-FEIGN-WITH-HYSTRIX-STREAM/10.106.192.57:microservice-consumer-movie-feign-with-hystrix-stream:8022: registering service...
2016-10-13 15:06:14.542 INFO 41459 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MICROSERVICE-CONSUMER-MOVIE-FEIGN-WITH-HYSTRIX-STREAM/10.106.192.57:microservice-consumer-movie-feign-with-hystrix-stream:8022 - registration status: 204
2016-10-13 15:06:14.548 INFO 41459 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2016-10-13 15:06:14.555 INFO 41459 --- [ main] ration$HystrixMetricsPollerConfiguration : Starting poller
2016-10-13 15:06:14.661 INFO 41459 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8022 (http)
2016-10-13 15:06:14.662 INFO 41459 --- [ main] c.n.e.EurekaDiscoveryClientConfiguration : Updating port to 8022
2016-10-13 15:06:14.668 INFO 41459 --- [ main] c.i.c.s.MovieFeignHystrixApplication : Started MovieFeignHystrixApplication in 14.338 seconds (JVM running for 15.302)
2016-10-13 15:06:59.127 INFO 41459 --- [nio-8022-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2016-10-13 15:06:59.128 INFO 41459 --- [nio-8022-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2016-10-13 15:06:59.202 INFO 41459 --- [nio-8022-exec-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 74 ms
2016-10-13 15:07:00.304 INFO 41459 --- [provider-user-1] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#353c426d: startup date [Thu Oct 13 15:07:00 CST 2016]; parent: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e6a5539
2016-10-13 15:07:00.407 INFO 41459 --- [provider-user-1] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2016-10-13 15:07:00.827 INFO 41459 --- [provider-user-1] c.netflix.config.ChainedDynamicProperty : Flipping property: microservice-provider-user.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2016-10-13 15:07:00.882 INFO 41459 --- [provider-user-1] c.n.u.concurrent.ShutdownEnabledTimer : Shutdown hook installed for: NFLoadBalancer-PingTimer-microservice-provider-user
2016-10-13 15:07:00.944 INFO 41459 --- [provider-user-1] c.netflix.loadbalancer.BaseLoadBalancer : Client:microservice-provider-user instantiated a LoadBalancer:DynamicServerListLoadBalancer:{NFLoadBalancer:name=microservice-provider-user,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2016-10-13 15:07:00.953 INFO 41459 --- [provider-user-1] c.n.l.DynamicServerListLoadBalancer : Using serverListUpdater PollingServerListUpdater
2016-10-13 15:07:00.993 INFO 41459 --- [provider-user-1] c.netflix.config.ChainedDynamicProperty : Flipping property: microservice-provider-user.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2016-10-13 15:07:00.996 INFO 41459 --- [provider-user-1] c.n.l.DynamicServerListLoadBalancer : DynamicServerListLoadBalancer for client microservice-provider-user initialized: DynamicServerListLoadBalancer:{NFLoadBalancer:name=microservice-provider-user,current list of Servers=[10.106.192.57:8001, 10.106.192.57:8000],Load balancer stats=Zone stats: {defaultzone=[Zone:defaultzone; Instance count:2; Active connections count: 0; Circuit breaker tripped count: 0; Active connections per server: 0.0;]
},Server stats: [[Server:10.106.192.57:8001; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970; First connection made: Thu Jan 01 08:00:00 CST 1970; Active Connections:0; total failure count in last (1000) msecs:0; average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0; min resp time:0.0; max resp time:0.0; stddev resp time:0.0]
, [Server:10.106.192.57:8000; Zone:defaultZone; Total Requests:0; Successive connection failure:0; Total blackout seconds:0; Last connection made:Thu Jan 01 08:00:00 CST 1970; First connection made: Thu Jan 01 08:00:00 CST 1970; Active Connections:0; total failure count in last (1000) msecs:0; average resp time:0.0; 90 percentile resp time:0.0; 95 percentile resp time:0.0; min resp time:0.0; max resp time:0.0; stddev resp time:0.0]
]}ServerList:org.springframework.cloud.netflix.ribbon.eureka.DomainExtractingServerList#14ee3ae0
2016-10-13 15:07:01.302 INFO 41459 --- [ HystrixTimer-1] FeignHystrixClient$HystrixClientFallback : 异常发生,进入fallback方法,接收的参数:id = 4
2009########
2016-10-13 15:07:01.959 INFO 41459 --- [erListUpdater-0] c.netflix.config.ChainedDynamicProperty : Flipping property: microservice-provider-user.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
Thanks.
I add this config hystrix.command.default.execution.timeout.enabled=false
in the application.yml, and it worked. And there is a similar solution here.Initial Request with Feign, Ribbon, Hystrix, and Consul Fails
Another solution is add config: spring.mvc.servlet.load-on-startup: 1. But this time, it still could turn on the hystrix rule to return false result.

Resources