diff --git a/build-config.png b/build-config.png new file mode 100644 index 000000000..0bdbaeecf Binary files /dev/null and b/build-config.png differ diff --git a/create-project.png b/create-project.png new file mode 100644 index 000000000..ea4c37a2f Binary files /dev/null and b/create-project.png differ diff --git a/db-params.png b/db-params.png new file mode 100644 index 000000000..1c54c0f7c Binary files /dev/null and b/db-params.png differ diff --git a/db.png b/db.png new file mode 100644 index 000000000..f364941aa Binary files /dev/null and b/db.png differ diff --git a/mysql-ephimeral.png b/mysql-ephimeral.png new file mode 100644 index 000000000..1b997444b Binary files /dev/null and b/mysql-ephimeral.png differ diff --git a/mysql-template-settings.png b/mysql-template-settings.png deleted file mode 100644 index a8f488789..000000000 Binary files a/mysql-template-settings.png and /dev/null differ diff --git a/output-ui.png b/output-ui.png new file mode 100644 index 000000000..10dc83bca Binary files /dev/null and b/output-ui.png differ diff --git a/petclinic-deploy.png b/petclinic-deploy.png new file mode 100644 index 000000000..b9668645d Binary files /dev/null and b/petclinic-deploy.png differ diff --git a/petclinic-url.png b/petclinic-url.png new file mode 100644 index 000000000..bc81ecd4e Binary files /dev/null and b/petclinic-url.png differ diff --git a/readme.md b/readme.md index 8982dfcc3..60f21698a 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,7 @@ +# Sprint PetClinic and OpenShift + +## Local Development + ``` mvn package @@ -50,11 +54,54 @@ http://localhost:8080 ![Screenshot](screenshot.png) +## For OpenShift: -For OpenShift +### Dev Console -![MySQL Template](mysql-template-settings.png) +Create a new OpenShift `Project` with `spring-petclinic-devconsole` name. -Edit the DeploymentConfig for the application pod +![Create Project](create-project.png) + +Then move to Developer perspective: + +![Dev Perspective](switch-perspective.png) + +And create a new MySQL instance by clicking the `+Add` button and choose the `Database` option: + +![Add DB](db.png) + +Choose MySQL Ephimeral: + +![MySQL Ephimeral](mysql-ephimeral.png) + +and Push `Instantiate Template`. + +Then fill the wizard with the following parameters: + +![MySQL Template](db-params.png) + +Push the `Create` button. + +Let's deploy the Pet Clinic app. + +Click the `+Add` button and choose `From Git` type: + +Fill the Git repo with the following value `https://github.com/burrsutter/spring-petclinic` and select the project as Java project: + +![Pet Clinic Deploy](petclinic-deploy.png) + +Push the `Build Configuration` link: + +![Build Configuration](build-config.png) + +Add the following environment variables for the application Pod: ![DC Env Vars](app-env-vars.png) + +Finally push the `Create` button and wait until the Build is done and the Pod is up and running (dark blue around the deployment bubble). +Then push the Open URL button to view the Pet Clinic app: + +![Pet Clinic Deployment](petclinic-url.png) + + +![Pet Clinic UI](output-ui.png) diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java b/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java index 79aa4cd9b..0d8c25cbe 100644 --- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java +++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerController.java @@ -15,6 +15,7 @@ */ package org.springframework.samples.petclinic.owner; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.samples.petclinic.visit.VisitRepository; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -41,12 +42,13 @@ class OwnerController { private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm"; - private final OwnerRepository owners; + // Comment Autowired + @Autowired + private OwnerRepository owners; private VisitRepository visits; - public OwnerController(OwnerRepository clinicService, VisitRepository visits) { - this.owners = clinicService; + public OwnerController(VisitRepository visits) { this.visits = visits; } @@ -82,6 +84,7 @@ class OwnerController { @GetMapping("/owners") public String processFindForm(Owner owner, BindingResult result, Map model) { + System.out.println("***" + owner.getLastName()); // allow parameterless GET request for /owners to return all records if (owner.getLastName() == null) { owner.setLastName(""); // empty string signifies broadest possible search diff --git a/switch-perspective.png b/switch-perspective.png new file mode 100644 index 000000000..7fbe76a17 Binary files /dev/null and b/switch-perspective.png differ