Refactor: Use environment variables for URLs and @Autowired for injection

Instead of hardcoding URLs for owners/createOrUpdateOwnerForm and pets/createOrUpdatePetForm in the code,
introduce environment variables for these values. Removed the static final type to allow injection.

Also, replaced constructor injection with @Autowired annotation for OwnerRepository to reduce lines of code.
This commit is contained in:
Gabriel Magioli 2023-12-29 16:08:45 -03:00
parent d1b096d6ca
commit a079a97c1e
3 changed files with 5 additions and 1 deletions

View file

@ -32,6 +32,8 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import jakarta.validation.Valid;

View file

@ -29,6 +29,8 @@ import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import jakarta.validation.Valid;