I have three SpringBoot services: ServiceA and ServiceB.
Both declare regular REST API points through Controllers:
- ServiceA
- createDocument(HTTP POST)
- deleteDocument(HTTP DELETE)
- ServiceB
- deleteFile(HTTP DELETE)
Internally, both endpoints of ServiceA call ServiceB’s endpoint with a Feign client:
- ServiceA.createDocument() -(lotsa stuff done)-> Feign(ServiceB.deleteFile())
- ServiceA.deleteDocument() -(not much stuff done)-> Feign(ServiceB.deleteFile())
First scenario: I bypass the inner call to Feign when I call ServiceA.createDocument(), then I call ServiceA.deleteDocument()
ServiceA.createDocument() --(lotsa stuff done)
ServiceA.deleteDocument() --(not much stuff done)-> Feign(ServiceB.deleteFile())
Then everything works fine. What was created in first call is deleted in the second call.
Second scenario: I don’t bypass the call to Feign when I call ServiceA.createDocument()
ServiceA.createDocument() --(lotsa stuff done)-> Feign(ServiceB.deleteFile())
Then the call to ServiceB fails with a 403 response.
In any subsequent call to ServiceA.deleteDocument() --(not much stuff done)-> Feign(ServiceB.deleteFile())
, the call to Feign will also fail with a 403, UNTIL I RESTART ServiceA and invoke ServiceA.deleteDocument() first thing again.
The need to reboot in the second scenario seems to imply that something is left in Spring’s context that prevents the call to ServiceB to succeed. But what can it be? How can I investigate and debug this call to ServiceB through Feign in both scenarii to find the hurting difference?