I am new to Spring Boot and Microservices. I have created RestController and tried to check using RequestMapping test but it give us error as 404, whitelabel error page. Below is pom.xml : Below is the code for the controller Below is Spring boot main class Server Start up logs are mentioned below : Any help …
Tag: spring-boot
what is the best application to store log in my spring boot application? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 1 year ago. Improve this question i am developing a new project to learn how work microservices in a spr…
Spring Boot service layer: Unit or Integration tests?
I have a service: I have written Integration tests for both database (BookRepository) and controller layer (BookController which uses BookService). I can’t find anywhere examples of integration tests for service layer. If I write unit tests properly, is there any use case for writting integration tests …
Integration tests with WireMock failing because no ALPN Processors are found
I’m writing some integration tests for a Spring Boot application written in Kotlin. To stub some HTTP requests, I’m using WireMock via spring-cloud-contract-wiremock as dependency. Some anonymized sample code from an integration test: While running these tests on my local machine, everything is wo…
How to deal with ResolutionException?
I’m trying to use Java Modules in my Spring Boot project and I’m getting the following exception: How can I solve this problem? Answer Try using JDK8 to run this code. It seems to be a compatability issue Edit: The root cause is that this package has been removed. (https://jcp.org/en/jsr/detail?id…
NPE while running test in Spring application (JUnit 5, Mockito 3, Spring JPA repositories)
I’m running a basic Spring App with Mockito 3.1.0 and and Junit 5.5.2. I have a Service call that includes two Spring Data JPA repositories. These are passed into the constructor for DI (along with two others that are immaterial – I’m including them in case they could also, potentially, cause erro…
How to make an integration test with one transaction for all database calls and rollback it afterwards?
I’m, writing an integration test, annotated with @SpringBootTest. Suppose I create some product using pure SQL from my test, call calculation service that do some calculations based on it, and it calls another service to save those calculation results in different tables. What I need is to rollback all …
testEntityManager.persistFlushFind() giving error “detached entity passed to persist”
I was trying to test h2 Repository with spring-boot-testing .Below is the Testing code is used.: In the above code I am facing this “detached entity passed to persist”. “testEntityManager.persistFlushFind(new Product(1,”A”,”dec”,false))” is giving below error: P…
Time Elapsed for Mono Webflux
I am calling a post endpoint that returns a Void. I am trying to get the time elapsed. It seems it is not calling an endpoint. doOnSuccess is also not getting called. Answer elapsed() measures the time between when the Mono is subscribed to and the moment the Mono emits an item. But, Mono<Void> response…
Issues with enclosing PDDoucment
I have implemented a program that will print data into a pdf however I am facing this issue I know there have been similar issues posted but I could not find the solution to my problem from them. What I am doing is that I initialized two documents one of them being the main document(doc) the other for the res…