I’m trying to validate an Enum using the custom validator, in my custom validator I’m trying to return a custom message when a parameter does not exist in the enum values. Bellow my enum Bellow my PostMapping method I can’t switch the type of enum to string in the method itself because IR…
Tag: spring-boot
Variables are not coming up null during Postman call
Setting up an Java Postman call assigning values to the variables but its shows null. My Pojo Student Class Postman Request Answer your request body should be like this: because you are getting StudentRequest as RequestBody and it means you should send StudentRequest internal properties not containing Student…
javax’s @Valid annotation usage scenario
Is it possible to use @Valid (javax.validation.Valid) in below scenario? Here JsonStringToObjectConvertor is taking in JSON in form of String and mapping it to IncidentModel class. I have defined few validations in IncidentModel in below manner and I want to validate the fields mapped by ObjectMapper in Incid…
How to handle Docker-Secrets in application.properties files
How do you inject Docker secrets (files/data from /run/secrets) into the application.properties files? Is it safe to use environment variables? Answer First of all, usage of environment variables for secret data for the application.properties isn’t safe. You have mainly two options when talking about Se…
How to manage memory using Spring Boot Maven Plugin with Kubernetes
I’m using spring boot 2.5.6 and I’m generating the docker image with the spring boot maven plugin. I’m deploying the application using AWS EKS with nodes managed by fargate. The plugin configuration is the following The command I use to execute it is the following When the application is dep…
How to Log/ View AWS Java SDK HTTP(S) Requests
I am developing a Spring Boot Application that uses HTTPS Only. I am using AWS services and the corresponding AWS Java SDK. How can I view the HTTP(S) request that the java sdk methods call on the backend of my application? I want to make sure when doing uploads to S3, etc, that everything is done over HTTPS …
Axon in Java app – reacting to event handler errors
Apologies if this has already been covered, I am new to Axon, and I believe I have read through related Axon documentation and scanned through questions and not found anything which covers my question. Here is my query… With Axon, I understand that I can create a command, send it to the gateway, it then…
How to mock my service using Mockito framework
Hello I have struglling write a mock test according to my following method below; my code below; my yml configuration below; my service below; I have a created PropertySourceResolver class and my test class below; I like to change my code according to test scenarios like ; when … then return any idea? t…
How to access a child element in a query using jpa and hibernate – SpringBoot
I would like to know how to query some child objects using their name as a parameter in Spring boot. Let’s say I have a class parent with a one-to-many relationship with the child. The child has a parameter called name. So I would like to query using like “%name%” so the query would return m…
Showing a specific JSON response for my GET endpoint
I have a many-to-many relationship between Department and Employee I have already done a mapping for the GET endpoint which returns a list of departments that contain Employees, this is the request: http://localhost:8080/api/departments/1/employees, and this is the response I get: This is the code that gets t…