• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Spring Boot Microservice - ServiceTest and ControllerTest for Junit throwing java.lang.StackOverflow

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a problem in running any test method in service test and controller test in one of the spring boot microservices (order service).

After I completed service and controller , I tried to write their test methods but I have a problem in there.

How can I fix it?

Here is one of the test method of OrderServiceTest shown below



Here is one of the test method of OrderControllerTest shown below.



Here is the error when I run any method of service test and controller shown below.



**To run the app,**

1 ) Run Service Registery (Eureka Server)

2 ) Run config server

3 ) Run zipkin and redis through these commands shown below on docker



4 ) Run api gateway

5 ) Run other services

Here is the repo : [Link][1]

Here is the **result of the service test** screenshot : [Link][2]

Here is the **result of the controller test** screenshot : [Link][3]

 [1]: https://github.com/Rapter1990/microservicecoursedailybuffer
 [2]: https://ibb.co/FwmdLLS
 [3]: https://ibb.co/MZwD22Q
 
Bartender
Posts: 2266
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There seems like a circular dependency in your domain objects. Try to search for @JsonIgnore and see if that works for you:
https://www.appsdeveloperblog.com/jsonignore-annotation-in-java/
 
Kevin Rapter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't think it throws the error due to the @JsonIgnore annotation.
I found this link before bu it didn't help me fix the issue.
Here is the link : https://github.com/spring-projects/spring-framework/issues/29215
I hope you can help me.
 
Kevin Rapter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Himai Minh wrote:There seems like a circular dependency in your domain objects. Try to search for @JsonIgnore and see if that works for you:
https://www.appsdeveloperblog.com/jsonignore-annotation-in-java/




Here is the link which is related with my issue : https://github.com/spring-projects/spring-framework/issues/29215

I still couldn't fix the issue.

I hope you can help me.
 
Kevin Rapter
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kevin Rapter wrote:

Himai Minh wrote:There seems like a circular dependency in your domain objects. Try to search for @JsonIgnore and see if that works for you:
https://www.appsdeveloperblog.com/jsonignore-annotation-in-java/




Here is the link which is related with my issue : https://github.com/spring-projects/spring-framework/issues/29215

I still couldn't fix the issue.

I hope you can help me.




Can you help me if you have any idea about it?
 
reply
    Bookmark Topic Watch Topic
  • New Topic