getting status code as "DOWN" for actuator/health endpoint - java

I have recently updated my spring-boot project to 2.7.5 from 2.0 version, i got some documentationPluginsBootstrapper related error and swagger did't open.
with this link i have added bean and new property in properties file, than it started workig fine..
Spring Boot 2.6.0 / Spring fox 3 - Failed to start bean 'documentationPluginsBootstrapper'
i have actuator dependency in my project(i can't remove the dependency) for actuator/health endpoint im getting status code down..
I'm getting like this for working url
{"groups":[],"status":{"code":"DOWN","description":""}}

Need to Add the below on your config file properties/yaml :
management.endpoint.health.show-details=always

Related

Intellij Spring - Invalid content was found starting with element '{"http://www.springframework.org/schema/context":compnent-scan"}'

I am trying to learn Spring through using the Intellij IDE. I don't understand this error in my pom.xml:
The error message I am getting when I try to add the component-scan context tag
I am trying to add the component-scan context so that Spring can detect beans automatically.
my pom.xml

#Value inside class file in third party jar spring boot

I am working on a migrating an old Spring XML config-based app to Spring Boot and there are third party jars which have #Value("$ properties referenced in them. I tried loading a custom property file placed under /resources in the new Spring Boot workspace and loading it with #PropertySource("classpath:file") but during the Spring Boot run the property does not seem to be loaded and get this below error:
Could not resolve placeholder 'com.example.propertyName' in value "${com.example.propertyName}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:178)
~[spring-core-5.2.2.RELEASE.jar:5.2.2.RELEASE]
You can bind the properties values using annotation #Value then mentioned the key on it.
you can follow the below link for end to end example
click

Multiple annotations found at this line: Factory bean not Found

I am building a Spring project in Spring Tool Suite(3.6.4.RELEASE).
I am trying to upgrade spring framework version from 4.0.3.RELEASE to 4.2.7.RELEASE using maven.
Before upgradation there was no error and everything running smoothly. Now project is compiling and running without error but login page is not showing and also I am getting error in my spring security configuration xml.
Error in spring-security.xml:
Showing following error on STS hovering:
Multiple annotations found at this line:
- Factory bean 'org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser
$DefaultWebSecurityExpressionHandlerBeanFactory' not found [config set: mcare-dashboard-web/web-context]
- Factory bean 'org.springframework.security.config.http.HttpConfigurationBuilder
$SecurityContextHolderAwareRequestFilterBeanFactory' not found [config set: mcare-dashboard-web/web-context]
Project Hierarchy:
My pom.xml was like following:
Then I just changed the version number like this:
After that spring-security.xml was showing the error.
Can anybody explain why is this happening?
You state that you are upgrading Spring from version 4.0.3.RELEASE to 4.2.7.RELEASE. However effectively you are upgrading both Spring and Spring Security. This due to having a single version property, named org.springframework-version, to manage both the version of the Spring and Spring Security dependencies.
So changing org.springframework-version to 4.2.7.RELEASE effectively upgrades Spring Security as well.
To fix this you want to have two distinct version properties one for Spring and another for Spring Security. You can than upgrade only Spring or Spring Security.

Spring Web Reactive not working as war file deployed on Tomcat 8.5

I have Spring Boot (2.0.0 M5) application which provides some REST API. I'd like to implement this API using RouterFunctions.
While I'm running app using embedded Jetty everything works fine.
When I convert the app to WAR file (following documentation here) and deploy it to Tomcat 8.5 I always get 404 when trying to call any of the endpoints.
I can see in the log that endpoints are recognised:
[ost-startStop-1] s.w.r.r.m.a.RequestMappingHandlerMapping : Mapped "{[/say-hello],methods=[GET]}" onto java.lang.String com.example.demo.DemoController.test()
[ost-startStop-1] o.s.w.r.f.s.s.RouterFunctionMapping: Mapped /api => {
/v1 => {
/status ->
com.example.demo.DemoApplication$$Lambda$189/1904651750#5fdc83e
}
}
But when calling curl -v http://localhost:8080/demo/say-hello or curl -v http://localhost:8080/demo/api/v1/status I see default Tomcat 404 page. The path is correct, I rename .war to demo.war before deploying it.
Did anybody come across similar issue? You can find the code here.
I'm afraid the WAR deployment model is not supported in Spring Boot for WebFlux at the moment. Spring Framework does support that model (although I'm not sure it supports deploying an app to a non-root context).
You can always create an issue on the Spring Boot issue tracker, but I'm not sure this will be implemented, as deploying to a Servlet container is not the primary focus there (and you can't do that with Netty).
Quick note: adding #EnableWebFlux is a signal that you'd like to take the WebFlux configuration in your own hands and that Spring Boot should not auto-configure things for you in that space.
Answering it now just in case some one else is still facing this issue.
In the POM file, you need to exclude the netty and add tomcat separately.
compile ('org.springframework.boot:spring-boot-starter-webflux') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-
reactor-netty'
}
compile 'org.springframework.boot:spring-boot-starter-tomcat'
Please check the link for full code : https://github.com/sushantkr16/Spring-boot2-webflux-annotation

Integrating BIRT report in Spring Boot application

I am trying to integrate BIRT reports into my existing spring boot application with the help of BIRT in spring boot app but I am using maven. when I add the dependency to BIRT 4.6.0-20160607 it was giving
Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes"
and when I change dependency to 4.5.0a it was giving
Error creating bean with name 'mongo' defined in class path resource [org/springframework/boot/autoconfigure/mongo/MongoAutoConfiguration.class]
kindly help me.
Use #EnableAutoConfiguration(exclude = {MongoAutoConfiguration.class}) in BirtReportRunnerApphlication...

Categories

Resources