title: 504 gateway error in Springboot application due to non access of the web URL for sometime
body: <p>I'm facing 504 gateway error in Spring boot application deployed in cloud foundry,when I don't access the WEB URL for sometime and refresh the page. Its a web application build on top of Spring Boot and Deployed in Cloud Foundry. Could you please suggest me why I am getting the issue and how can I fix it. </p>
  
  <p>Note: Oracle DB has been used for data storage and SQL queries are used to Query the data from DB. We are restarting the service when ever 504 gateway error has thrown in order to bring up the service.</p>
  
  <p>Logs</p>
  
  <pre><code>---------------------------------------------------------------------------2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] 2018-06-20 09:58:30.190 ERROR 17 --- [nio-8080-exec-8] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet dispatcherServlet threw exception
  
  2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] org.springframework.web.client.HttpServerErrorException: 504 Gateway Time-out
  
  2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:94)
  
  2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:700)
  
  2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:653)
  
  2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:621)
  
  2018-06-20T11:58:30.190+02:00 [APP/PROC/WEB/0] [OUT] at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:295)
  </code></pre>