Skip to content

Tag: spring

Why assigning instance variable to local variable?

This is something I see in Spring Boot code for example (in the catch block with webServer variable): Why not just doing this.webServer.stop()? What is the purpose of local variable webServer? Answer The main purpose of the assignment is to avoid producing a NullPointerException when the this.webServer is set…

Why handleResponse(URI url, HttpMethod method, ClientHttpResponse response) method of RestTemplate.class is getting called for a 200 Succeess response

I am calling an external API from my code using RestTemplate like below: This API call is returning 200 Success but when I debug it, it still goes to handleResponse(URI url, HttpMethod method, ClientHttpResponse response) method of RestTemplate.class And then it’s coming to my RestTemplateErrorHandler.j…

How starter-web prevent spring-boot exit?

When using spring-boot-starter-web, The spring-boot application won’t exit after startup. And with Jetbrain IDEA, There is an icon show spring-boot start up finished: But if I using : Or Can let spring-boot keep running but the IDEA icon will loading forever, So that must be different way compare with s…