Skip to content

Tag: spring-boot

How to get customize JSON object response in spring boot

I need to need to get customized JSON object rather than default one in Spring Boot. I could successfully get default response but I need to customize as below. Some objects needed to be converted to array and some fields should be removed. Actual Response Expected Response Changes Service Class Implementatio…

SpringBoot ignoring my @RequestBody param?

I have the following Controller: The ProductCost model looks like: My problem is that when calling that endpoint, the productCost variable comes with all fields set to null, even though I’m seding it real data. The request body looks like: Am I missing something obvious? Why is the Product Cost not mapp…

Spring Boot 2.x Servlet Path is ignored in test

in my application-test.properties I have this server.servlet.context-path=/api It works totally fine when I run the application and test it with postman. But as soon as I run my tests it swallows the part /api of the path. So basically how it should be localhost:8080/api/testUrl but the controller is only ava…

Java file outside of source root intelliJ

I have cloned a spring boot project from GitLab having multiple branches in IntelliJ. I checkout to the branch in which I want to work. But I am getting “Java file outside of source root” on all the files. Please suggest what I am doing wrong. I just installed IntelliJ and it’s the first pro…