Skip to content

Tag: spring

Paketo BuildPacks Java JSON Log for Spring Boot Application

We are using Paketo BuildPacks for our Spring Boot application. We configured all logs to be JSON written to STDOUT. The issue is that there’s a few lines of logs by Paketo during startup: Is there any way to configure Paketo to print the above as JSON: Answer No, sorry. The logging format in Paketo Bui…

How to convert String to UTC timezone?

I have a string like this, I have a utility which converts this string to UTC time This returns the result 2022-12-09T12:21:32Z It gives back the time difference of 4 hours. Shouldn’t it be 5 hours? Answer There is a time change in EST timezone on October 30th, try in September and you have only 4 hours…

Mocking a Nested Object in Junit

I have a service I am mocking like this: } the service: I need to be able to mock the “CloseableHttpResponse response = httpclient.execute(request, clientContext)”, such that the “response” object is something I create ahead of time. I am hoping some mocking when/then constructs would …