Search code examples
javaspring-mvcweb-applicationscloudprofile

How do I differentiate between Cloud and Development Profiles?


I need to store Images in cloud when my web application is launched in cloud but when I am developing in my local environment that is localhost I need to store images in local file path in spring mvc mysql java application.How Can I achieve this?Is this a recommended approach?What is the best practice to achieve this?


Solution

  • Using Environment object I can determine whether it is running on development or cloud profile.

    environment.getActiveProfiles();