This question may seem pretty naive but I've just started using cloud foundry. I installed the eclipse plugin & deployed a sample app. But everytime, while running the app in local or starting the server it is being pushed to the remote cloud server & running on a unique domain
xxxxx.cfapps.io
Is there a way to run the app on localhost during development? Without connecting to the remote server & pushing every time, just like Google App Engine enables us to. Pushing every time makes the development process slow.
I tried to start the server without an internet connection it just won't start. Gives a sockettimedout exception.
Or is there any other way or workaround to develop in local & finally push the app to cloud foundry?
The Java applications you deploy to Cloud Foundry are going to be regular .WAR files (or Spring Boot .JARs) without any hard dependencies on the Cloud Foundry environment. So you should be able to iterate and test on these artifacts in your local environment just fine.
The only significant issue you should enconter is if your app has a dependency on a bound service in the Cloud Foundry environment. In this situation, I would recommend the use of Spring Cloud Connectors (http://cloud.spring.io/spring-cloud-connectors/).
Let's say my application binds to a Redis service in the Cloud Foundry environment. I can inject this service with Spring Cloud like this:
Now, my code can check to see if _redisTemplate is null. If so, I am running locally without Redis.
Or maybe I do have a local Redis instance to test against. In which case, I go with:
In my local environment, I start up with the environment profile local. With Spring Profiles, I declare the implementation of RedisTemplate to use the local instance for this profile. When I deploy to Cloud Foundry, the app will automatically start with the cloud profile, and will bind to the Cloud Foundry Redis instance instead of your local instance.