I have a SpringBoot based web application that exposes a consul health indicator bean. The bean is correctly created and initialized by springboot’s autoconfiguration, yet, the indicator is not showing in the actuator health endpoint despite the fact that the associated configuration property “man…
Tag: spring-boot
How to get list of data containing count of a field using Aggregation and Criteria in Spring Boot with MangoDB
Requirement: documents-bookdata collection may have multiple objects with same bookPublisherName but different bookName. Means multiple books can have same publisher so need to extract count of books per publisher . Model class: Response format pojo Response Format Answer This requirement can also be done log…
Programmatically restart HikariPool in Spring Boot application?
I have a Spring Boot application which uses Hibernate, and HikariDataSource / HikariPool to talk to the database. A special feature in the app triggers database restart. Currently this breaks the connections in HikariPool: Old version of the app does call programmatically org.hibernate.SessionFactory.close();…
How to configure separately both consumer and producer spring boot app when using rabbitmq?
I watched a tutorial that explains how to integrate RabbitMQ into Spring Boot app. In the tutorial, the ReceiveMessageHandler.java (Consumer) and SendMessageController.java (Producer) classes were in the same project. I want to implement them in two different Spring Boot application. However I can’t spl…
change the json object value
I have a json object like above and i want to change apiInvokerPublicKey’s value i did not find a method in gson so how can i change it? EDIT: I used addProperty method from gson but it changes whole “onboardingInformation” i just want to change “apiInvokerPublicKey” Answer You c…
AWS SQS – MessageConsumer stops to receive messages after a while
My application registers a listeners to a SQS queue (queue itself is populated by a SNS topic). When I start the application, message consumer is working as expected but after a while it stops to receive any messages. Can it be that consumer is shutting down after a while? Suggestions or comments would be muc…
Making a Spring Boot Configuration Fault Tolerant [closed]
I have a Spring Boot Application that relies on various services like Keycloak, Elastic Stack, and PostgreSQL. This application will be deployed to an Kubernetes cluster along with a number of other …
Spring Security – How to get the roles assigned to user
I am implementing JWT Role Based Authorization. I am testing my apis through postman. The users first makes a POST request and registers itself where we pass in the firstname, empid and password. The user on successfull registarion returns a response including a column roles which is null in the starting. The…
JPA many to many relationship causing infinite recursion
Edit: I solved the problem using @JsonIgnoreProperties in both classes I have two entities in my api. Pokemon which has a list of “types” that pokemon have and Type which has a list of “pokemon” that have that specific type. I’m trying to implement a getAll method in my controlle…
Should I annotate pojo class with @Component?
I searched whether I should annotate POJO with @Component or not. It seems like it is recommended not to annotate pojo. Here is my OrderStatusMnemonic Configuration class that reads a txt file: OrderStatus POJO: Since I am autowiring OrderStatus POJO class I am getting error: Consider defining a bean of type …