Skip to content
Advertisement

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 to null by a concurrent thread after the null-check and before

No qualifying bean of type ‘org.springframework.boot.actuate.metrics.MetricsEndpoint’

I upgraded spring.version from 5.0.18.RELEASE to 5.3.21 and spring.boot.version from 2.1.18.RELEASE to 2.7.0 spring-boot-starter-actuator ${spring.boot.version} In my Healthcheck class I use: After upgrade I’ve got: Why Spring doesn’t see org.springframework.boot.actuate.metrics.MetricsEndpoint ? Answer 2.1.18.RELEASE to 2.7.0 is an enormous jump, so as the comment says I’d suggest checking the upgrade guide carefully. Nonetheless, you need to expose the metrics endpoint in

Why are Spring libraries including same parent packages made seperate?

I’ve just noticed two different libraries sharing paths. Example is as follows. There are two seperate packages – spring-boot-actuator, spring-boot-actuator-autoconfigure. Packages included in these libraries share the same parent package or package path. I can’t imagine the things under the hood. Wouldn’t this lead to linking errors? Answer Package a.b.c is different from a.b.c.d, there is no hierarchical relationship between

NoSuchBeanDefinitionException with reactive mongo repository: required a bean of type that could not be found

I have an issue: repository bean couldn’t be found when it’s placed in outer package. It causes nested UnsatisfiedDependencyException which is due to NoSuchBeanDefinitionException (expected at least 1 bean which qualifies as autowire candidate). After I copied the class to my project, it works perfectly. But I would like to use it as a dependency on external module. This is

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.java file Can someone lease help me to understand if it’s the correct behaviour. I suspect

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 starter-web. Update1: And those two method will cause SpringBootTest wait forever

Spring boot – org.postgresql.util.PSQLException: FATAL: password authentication failed for user “postgres” [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 8 months ago. Improve this question

Advertisement