In my Java web application with Spring Boot I have Keycloak authentication done but now I need to get user details of some user by id (not user that is logged in). Is it possible ? I want to get his roles, groups and data from Java code. Answer You can use the REST API by getting an access token
Tag: spring-boot
Spring Boot + Elastic Search : Connection Refused with Java RestHighLevelClient
I am implementing an elastic pool for my spring boot project also I am using spring boot 2.1.4 and elastic search 7.3.0. I am stuck at this. When any API trying to query it gives java.net.ConnectException: Connection refused. I want to use configuration with customizeHttpClient with a setting thread count. So…
Why I am not getting error message in postman using Spring Boot Application
I want “Admin not found” message to display in Postman during invalid login but I am getting this as postman output AdminController.java ResourceNotFoundException.java My Postman URL http://localhost:8989/api/adminLogin My admin login success is working fine Answer I solved the problem by includin…
How can i add data to th:action form
I have a spring-boot application. Full url that I need: localhost:8080/company/{companyName}/users?name={name}. In the beginning i choose company, for ex. : localhost:8080/company/google. The controller redirects me to the page with the form (company.html), where i type name. Controller: In Data class i simpl…
SpringBoot DTO Validation
I am new to spring-boot I’m trying to add validation to my DTO class like below. Below is my REST endpoint to save employee. I create a Validation class like below to validate the DTO fields. expected output is { “firstName”:”Employee first name is required”, “employeeNum&#…
convert SpEL output to long to use as an annotation argument
Currently, I can use String arguments using SpEL as follows: It works fine but if I want a long constant it will not be work : So, How to fix it? Also, I cannot give Long and it accepts only long edit : I have gone through many similar SpEL questions but there were no applicable solutions for my case.
How to make Swagger put new line in the generated HTML (in Swagger UI page)?
I have a REST service method annotated with io.swagger.annotations.ApiOperation @ApiOperation(value = “some string”) I need some string to generate newlines in the HTML page swagger-ui.html (i.e. in the Swagger UI page where I see my docs and I can test my API methods). I tried putting <br/>…
Error processing condition on org.springframework.boot.actuate.autoconfigure.metrics.MetricsEndpointAutoConfiguration
I am a novice Java Spring programmer. I am moving some test code from an older jHipster project to a new one. I added this to the pom.xml to fix a compilation error. This fixed my compilation issue but caused runtime errors. I am now getting these runtime errors. Caused by: java.lang.IllegalStateException: Er…
Parameter 0 of constructor in ‘ ‘ required a bean of type ‘ ‘ that could not be found
I am creating a spring boot application, wherein any client can submit the request, these request can be GET, PUT, POST, DELETE. But while creating this application, I am getting the following errors: The structure of my application is: PersonDao.java PersonService.java I know that many questions with the fol…
How to gracefully shutdown spring-kafka consumer application
i have implemented spring-kafka consumer application. i wants consumer application graceful shutdown. the current consumer application is terminated with the Linux command kill -9 pid i am using @KafkaListener annotation now. if i quit the Spring boot app, i want to reliably close the consumer, what should i …