1

I am using spring cloud to bind services to a spring boot application deployed to CloudFoundry. When running locally, I can pass Java options to the application as follows:

-Dspring.jpa.hibernate.ddl-auto=create-drop

Now I would like to do the same thing when running the application on CloudFoundry. What's the usual way to do this?

user152468
  • 3,202
  • 6
  • 27
  • 57

2 Answers2

2

An alternative to setting a system property or environment variable is to set this as a Spring property in src/main/resources/application.properties or src/main/resources/application.yml.

application.properties:

spring.jpa.hibernate.ddl-auto=create-drop

application.yml

spring:
  jpa:
    hibernate:
      ddl-auto: create-drop

With this approach, the configuration will be applied regardless of now the app is deployed - locally, on CF, or on another platform.

Scott Frederick
  • 4,184
  • 19
  • 22
0

You can put an env entry in your manifest.yml file like so:

env:
  spring.jpa.hibernate.ddl-auto: create-drop

See more information here:

http://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#env-block

Corby Page
  • 1,385
  • 10
  • 17
  • 1
    When setting this as an environment variable, you might have to set SPRING_JPA_HIBERNATE_DDL-AUTO instead of the dot notation. – Scott Frederick May 22 '15 at 14:06