diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
index 675b2140e45..c9e6ef17422 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
+++ b/src/main/java/org/springframework/samples/petclinic/owner/Owner.java
@@ -20,6 +20,8 @@
import org.springframework.core.style.ToStringCreator;
import org.springframework.samples.petclinic.model.Person;
+import org.springframework.samples.petclinic.pet.Pet;
+import org.springframework.samples.petclinic.visit.Visit;
import org.springframework.util.Assert;
import jakarta.persistence.CascadeType;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java b/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java
index 5d7a40fbbe9..e6251a62e9a 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java
+++ b/src/main/java/org/springframework/samples/petclinic/owner/OwnerRepository.java
@@ -23,7 +23,7 @@
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.transaction.annotation.Transactional;
+import org.springframework.samples.petclinic.pet.PetType;
/**
* Repository class for Owner
domain objects All method names are compliant
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Pet.java b/src/main/java/org/springframework/samples/petclinic/pet/Pet.java
similarity index 95%
rename from src/main/java/org/springframework/samples/petclinic/owner/Pet.java
rename to src/main/java/org/springframework/samples/petclinic/pet/Pet.java
index 03fd26c9375..aa58d9ca40a 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/Pet.java
+++ b/src/main/java/org/springframework/samples/petclinic/pet/Pet.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import java.time.LocalDate;
import java.util.Collection;
@@ -32,6 +32,7 @@
import jakarta.persistence.OneToMany;
import jakarta.persistence.OrderBy;
import jakarta.persistence.Table;
+import org.springframework.samples.petclinic.visit.Visit;
/**
* Simple business object representing a pet.
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetController.java b/src/main/java/org/springframework/samples/petclinic/pet/PetController.java
similarity index 94%
rename from src/main/java/org/springframework/samples/petclinic/owner/PetController.java
rename to src/main/java/org/springframework/samples/petclinic/pet/PetController.java
index fcf431bff68..cf7abc48865 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetController.java
+++ b/src/main/java/org/springframework/samples/petclinic/pet/PetController.java
@@ -13,12 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import java.time.LocalDate;
import java.util.Collection;
import java.util.Optional;
+import org.springframework.samples.petclinic.owner.Owner;
+import org.springframework.samples.petclinic.owner.OwnerRepository;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
@@ -67,7 +69,7 @@ public Owner findOwner(@PathVariable("ownerId") int ownerId) {
@ModelAttribute("pet")
public Pet findPet(@PathVariable("ownerId") int ownerId,
- @PathVariable(name = "petId", required = false) Integer petId) {
+ @PathVariable(name = "petId", required = false) Integer petId) {
if (petId == null) {
return new Pet();
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetType.java b/src/main/java/org/springframework/samples/petclinic/pet/PetType.java
similarity index 94%
rename from src/main/java/org/springframework/samples/petclinic/owner/PetType.java
rename to src/main/java/org/springframework/samples/petclinic/pet/PetType.java
index eeea6a758df..a18241d3f3d 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetType.java
+++ b/src/main/java/org/springframework/samples/petclinic/pet/PetType.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import org.springframework.samples.petclinic.model.NamedEntity;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetTypeFormatter.java b/src/main/java/org/springframework/samples/petclinic/pet/PetTypeFormatter.java
similarity index 94%
rename from src/main/java/org/springframework/samples/petclinic/owner/PetTypeFormatter.java
rename to src/main/java/org/springframework/samples/petclinic/pet/PetTypeFormatter.java
index 4fa18da9149..d8042674064 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetTypeFormatter.java
+++ b/src/main/java/org/springframework/samples/petclinic/pet/PetTypeFormatter.java
@@ -13,10 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.Formatter;
+import org.springframework.samples.petclinic.owner.OwnerRepository;
import org.springframework.stereotype.Component;
import java.text.ParseException;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java b/src/main/java/org/springframework/samples/petclinic/pet/PetValidator.java
similarity index 97%
rename from src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java
rename to src/main/java/org/springframework/samples/petclinic/pet/PetValidator.java
index 6422aa8db80..db891d591ed 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/PetValidator.java
+++ b/src/main/java/org/springframework/samples/petclinic/pet/PetValidator.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import org.springframework.util.StringUtils;
import org.springframework.validation.Errors;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/Visit.java b/src/main/java/org/springframework/samples/petclinic/visit/Visit.java
similarity index 96%
rename from src/main/java/org/springframework/samples/petclinic/owner/Visit.java
rename to src/main/java/org/springframework/samples/petclinic/visit/Visit.java
index 35569bdaaf5..ce775822663 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/Visit.java
+++ b/src/main/java/org/springframework/samples/petclinic/visit/Visit.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.visit;
import java.time.LocalDate;
diff --git a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java b/src/main/java/org/springframework/samples/petclinic/visit/VisitController.java
similarity index 92%
rename from src/main/java/org/springframework/samples/petclinic/owner/VisitController.java
rename to src/main/java/org/springframework/samples/petclinic/visit/VisitController.java
index b546f609a34..b07f4951f64 100644
--- a/src/main/java/org/springframework/samples/petclinic/owner/VisitController.java
+++ b/src/main/java/org/springframework/samples/petclinic/visit/VisitController.java
@@ -13,11 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.visit;
import java.util.Map;
import java.util.Optional;
+import org.springframework.samples.petclinic.owner.Owner;
+import org.springframework.samples.petclinic.owner.OwnerRepository;
+import org.springframework.samples.petclinic.pet.Pet;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
@@ -61,7 +64,7 @@ public void setAllowedFields(WebDataBinder dataBinder) {
*/
@ModelAttribute("visit")
public Visit loadPetWithVisit(@PathVariable("ownerId") int ownerId, @PathVariable("petId") int petId,
- Map model) {
+ Map model) {
Optional optionalOwner = owners.findById(ownerId);
Owner owner = optionalOwner.orElseThrow(() -> new IllegalArgumentException(
"Owner not found with id: " + ownerId + ". Please ensure the ID is correct "));
diff --git a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java
index 426ca5c24e4..a9938270975 100644
--- a/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/owner/OwnerControllerTests.java
@@ -25,6 +25,9 @@
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
+import org.springframework.samples.petclinic.pet.Pet;
+import org.springframework.samples.petclinic.pet.PetType;
+import org.springframework.samples.petclinic.visit.Visit;
import org.springframework.test.context.aot.DisabledInAotMode;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java b/src/test/java/org/springframework/samples/petclinic/pet/PetControllerTests.java
similarity index 97%
rename from src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java
rename to src/test/java/org/springframework/samples/petclinic/pet/PetControllerTests.java
index 9a6134cbb7f..5d8b50efd0e 100644
--- a/src/test/java/org/springframework/samples/petclinic/owner/PetControllerTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/pet/PetControllerTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.BeforeEach;
@@ -25,6 +25,8 @@
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
+import org.springframework.samples.petclinic.owner.Owner;
+import org.springframework.samples.petclinic.owner.OwnerRepository;
import org.springframework.test.context.aot.DisabledInAotMode;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;
diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java b/src/test/java/org/springframework/samples/petclinic/pet/PetTypeFormatterTests.java
similarity index 95%
rename from src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java
rename to src/test/java/org/springframework/samples/petclinic/pet/PetTypeFormatterTests.java
index 0295b47884d..06d236be96d 100644
--- a/src/test/java/org/springframework/samples/petclinic/owner/PetTypeFormatterTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/pet/PetTypeFormatterTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
@@ -32,6 +32,7 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.samples.petclinic.owner.OwnerRepository;
/**
* Test class for {@link PetTypeFormatter}
diff --git a/src/test/java/org/springframework/samples/petclinic/owner/PetValidatorTests.java b/src/test/java/org/springframework/samples/petclinic/pet/PetValidatorTests.java
similarity index 98%
rename from src/test/java/org/springframework/samples/petclinic/owner/PetValidatorTests.java
rename to src/test/java/org/springframework/samples/petclinic/pet/PetValidatorTests.java
index 1a153bcbc55..9df72770d42 100644
--- a/src/test/java/org/springframework/samples/petclinic/owner/PetValidatorTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/pet/PetValidatorTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.pet;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Nested;
diff --git a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java
index 17360278f45..806ec09a78d 100644
--- a/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/service/ClinicServiceTests.java
@@ -31,9 +31,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.samples.petclinic.owner.Owner;
import org.springframework.samples.petclinic.owner.OwnerRepository;
-import org.springframework.samples.petclinic.owner.Pet;
-import org.springframework.samples.petclinic.owner.PetType;
-import org.springframework.samples.petclinic.owner.Visit;
+import org.springframework.samples.petclinic.pet.Pet;
+import org.springframework.samples.petclinic.pet.PetType;
+import org.springframework.samples.petclinic.visit.Visit;
import org.springframework.samples.petclinic.vet.Vet;
import org.springframework.samples.petclinic.vet.VetRepository;
import org.springframework.transaction.annotation.Transactional;
diff --git a/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java b/src/test/java/org/springframework/samples/petclinic/visit/VisitControllerTests.java
similarity index 93%
rename from src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java
rename to src/test/java/org/springframework/samples/petclinic/visit/VisitControllerTests.java
index e42e75034ab..f60f52a2fd0 100644
--- a/src/test/java/org/springframework/samples/petclinic/owner/VisitControllerTests.java
+++ b/src/test/java/org/springframework/samples/petclinic/visit/VisitControllerTests.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.samples.petclinic.owner;
+package org.springframework.samples.petclinic.visit;
import static org.mockito.BDDMockito.given;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
@@ -28,6 +28,9 @@
import org.junit.jupiter.api.condition.DisabledInNativeImage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
+import org.springframework.samples.petclinic.owner.Owner;
+import org.springframework.samples.petclinic.owner.OwnerRepository;
+import org.springframework.samples.petclinic.pet.Pet;
import org.springframework.test.context.aot.DisabledInAotMode;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;