I tried with below code but in response body I got empty records. Please help me on below code. Java Code: Test Code: Answer You need to set the value of customer in your response. The values you are setting in customer object is not being used anywhere. Try this:
Tag: spring-boot
upload file size limit in spring boot
In version 2.1.0, spring.servlet.multipart.max-file-size property failed to bind org.springframework.util.unit.DataSize. Exception Answer As Michael & Stahorszki mentioned “B” must be capital In Yaml
How to query a Hierarchical Category tree entity with undefined depth
I have created a hierachy structure or a tree structure for a shopping site using springboot. My problem is how to query such a structure when looking for a specific product and its parents: This is what i have done, any pointers on what i need to do on the entity to achieve this structure and also how i can
How to disable AWS parameter store autoconfiguration for tests?
I have added spring-cloud-starter-aws-parameter-store-config dependency as explained in the spring documentation. Now, for unit tests I want to disable parameter store configuration. But not able to do it. I tried setting following property in test/application.properties Also tried excluding AwsParamStoreBootstrapConfiguration.class from AutoConfiguration but still not working. Exception Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement]: Factory method ‘ssmClient’ threw exception; nested exception
No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor
When i try to navigate to an endpoint i get the following error I checked all my models and all the attributes have getters and setters. So what’s the problem ? I can fix that by adding spring.jackson.serialization.fail-on-empty-beans=false but i think this is just a work around to hide the exception. Edit Product model: PagedResponse class : RestResponse Class :
How to returnDTO instead of entity in Spring boot pagination?
My DTO is different from entity. How can I return a DTO instead of entity with pagination while still showing information of all pages? Controller: Service: Repository: DTO: Entity: Answer The StudentDTO class can have a constructor with a Student parameter. Then you can call map on the Page object.
Spring boot where is my jar file
Spring boot makes it really easy to setup a simple app. But it takes me longer to actually get a jar file which I can upload to a remote server. I am using IntelliJ, no command line, and I use gradle. The application is running somehow out of Intellij. But where are the created files? Where is my jar from
Not able to add JPA dependency into spring-boot project
I am trying to add JPA Maven dependency to already created spring-boot project but I am getting following error: When I remove it the error is gone. pom.xml application.properties I tried to find answer online but none was solution for me. Also tried to create > Spring starter project > an there immediately add JPA, Web and H2 but still
Spring boot – @Service class calling another @Service class
Is it fine to have a @Service annotated class calling another @Service annotated class? Or it is a bad practice? Eg.: Answer It is not any restriction calling a service from another one. Unless you make circular dependency between services. Circular dependency : https://en.wikipedia.org/wiki/Circular_dependency Circular dependency in spring : https://www.baeldung.com/circular-dependencies-in-spring
MappingJackson2HttpMessageConverter configuration is not being recognized in spring boot 2
I am working with spring for a while already and in my spring boot 1.5x’s projects always dealing with the LazyInitializationException with the next configuration (more downstairs) but now I am creating a new project with spring boot 2 and the same configuration is not being recognized further than WebMvcConfigurer now replace to the deprecated WebMvcConfigurerAdapter. My configuration: But after