mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-22 15:25:49 +00:00
Moves to autowired
This commit is contained in:
parent
3c61ad3ade
commit
cdbb67ca91
1 changed files with 6 additions and 3 deletions
|
@ -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<String, Object> 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
|
||||
|
|
Loading…
Reference in a new issue