BIN
build-config.png
Normal file
After Width: | Height: | Size: 34 KiB |
BIN
create-project.png
Normal file
After Width: | Height: | Size: 287 KiB |
BIN
db-params.png
Normal file
After Width: | Height: | Size: 240 KiB |
BIN
db.png
Normal file
After Width: | Height: | Size: 302 KiB |
BIN
mysql-ephimeral.png
Normal file
After Width: | Height: | Size: 292 KiB |
Before Width: | Height: | Size: 194 KiB |
BIN
output-ui.png
Normal file
After Width: | Height: | Size: 356 KiB |
BIN
petclinic-deploy.png
Normal file
After Width: | Height: | Size: 162 KiB |
BIN
petclinic-url.png
Normal file
After Width: | Height: | Size: 75 KiB |
53
readme.md
|
@ -1,3 +1,7 @@
|
||||||
|
# Sprint PetClinic and OpenShift
|
||||||
|
|
||||||
|
## Local Development
|
||||||
|
|
||||||
```
|
```
|
||||||
mvn package
|
mvn package
|
||||||
|
|
||||||
|
@ -50,11 +54,54 @@ http://localhost:8080
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
## For OpenShift:
|
||||||
|
|
||||||
For OpenShift
|
### Dev Console
|
||||||
|
|
||||||

|
Create a new OpenShift `Project` with `spring-petclinic-devconsole` name.
|
||||||
|
|
||||||
Edit the DeploymentConfig for the application pod
|

|
||||||
|
|
||||||
|
Then move to Developer perspective:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
And create a new MySQL instance by clicking the `+Add` button and choose the `Database` option:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Choose MySQL Ephimeral:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
and Push `Instantiate Template`.
|
||||||
|
|
||||||
|
Then fill the wizard with the following parameters:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Push the `Build Configuration` link:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Add the following environment variables for the application Pod:
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.springframework.samples.petclinic.owner;
|
package org.springframework.samples.petclinic.owner;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.samples.petclinic.visit.VisitRepository;
|
import org.springframework.samples.petclinic.visit.VisitRepository;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
@ -41,12 +42,13 @@ class OwnerController {
|
||||||
|
|
||||||
private static final String VIEWS_OWNER_CREATE_OR_UPDATE_FORM = "owners/createOrUpdateOwnerForm";
|
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;
|
private VisitRepository visits;
|
||||||
|
|
||||||
public OwnerController(OwnerRepository clinicService, VisitRepository visits) {
|
public OwnerController(VisitRepository visits) {
|
||||||
this.owners = clinicService;
|
|
||||||
this.visits = visits;
|
this.visits = visits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +84,7 @@ class OwnerController {
|
||||||
@GetMapping("/owners")
|
@GetMapping("/owners")
|
||||||
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
|
public String processFindForm(Owner owner, BindingResult result, Map<String, Object> model) {
|
||||||
|
|
||||||
|
System.out.println("***" + owner.getLastName());
|
||||||
// allow parameterless GET request for /owners to return all records
|
// allow parameterless GET request for /owners to return all records
|
||||||
if (owner.getLastName() == null) {
|
if (owner.getLastName() == null) {
|
||||||
owner.setLastName(""); // empty string signifies broadest possible search
|
owner.setLastName(""); // empty string signifies broadest possible search
|
||||||
|
|
BIN
switch-perspective.png
Normal file
After Width: | Height: | Size: 311 KiB |