No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
README.md
create-service-MYSQL.sh
create-service-REGISTRY.sh
manifest.yml
pom.xml

README.md

SpringBoot JPA Bootstrap Employee Demo

The following demo shows how to use a H2 database while developing locally and then how to switch to a MySQl bound service instance in Pivotal Cloud Foundry. The blog entry below does into detail on how this works as well as how to enable the H2 web console in DEV mode.

http://theblasfrompas.blogspot.com.au/2016/09/using-h2-console-in-development-with.html

alt tag

Running Locally

  • Clone and package as follows
$ git clone https://github.com/papicella/SpringBootJPABootstrapEmployeeDemo.git
$ mvn package
  • Run as follows

Note: You will need a Eureka Server running locally with @EnableEurekaServer annotation on your Spring Boot main class for this demo to run locally.

$ mvn spring-boot:run

Push to Pivotal Cloud Foundry

  • Create required services on PCF
$ cf create-service cleardb spark apples-mysql
$ cf create-service p-service-registry standard service-registry
  • Push using manifest.yml as follows ensuring you use the correct MySQL service name
---
applications:
- name: springboot-bootstrap-employee
  memory: 1G
  instances: 1
  random-route: true
  timeout: 180
  path: ./target/springbootjpabootstrapemployeedemo-0.0.1-SNAPSHOT.jar
  services:
    - apples-mysql
    - service-registry
  env:
    JAVA_OPTS: -Djava.security.egd=file:///dev/urando
    SPRING_PROFILES_ACTIVE: cloud
  • Deploy to PCF
$ cf push 

Spring Cloud Service Registry - Bound Service Instance

alt tag


Pas Apicella [papicella at pivotal.io] is a Senior Platform Architect at Pivotal Australia