constructor injection instead of field injection

This commit is contained in:
2025-04-18 09:23:13 +02:00
parent e60f959dfb
commit 8fc8473962
3 changed files with 8 additions and 7 deletions

View File

@@ -1,9 +1,8 @@
package _11.asktpk.artisanconnectbackend.controller;
import _11.asktpk.artisanconnectbackend.dto.ClientDTO;
import _11.asktpk.artisanconnectbackend.repository.ClientRepository;
import _11.asktpk.artisanconnectbackend.service.ClientService;
import _11.asktpk.artisanconnectbackend.dto.ClientDTO;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

View File

@@ -15,11 +15,13 @@ import java.util.List;
@RequestMapping("/api/v1/notices")
@RestController
public class NoticeController {
@Autowired
private NoticeService noticeService;
private final NoticeService noticeService;
private final ClientService clientService;
@Autowired
private ClientService clientService;
public NoticeController(NoticeService noticeService, ClientService clientService) {
this.noticeService = noticeService;
this.clientService = clientService;
}
@GetMapping("/get/all")
public List<NoticeDTO> getAllNotices() {

View File

@@ -1,7 +1,7 @@
spring.application.name=ArtisanConnectBackend
## PostgreSQL
spring.datasource.url=jdbc:postgresql://192.168.56.103:5432/default_db
spring.datasource.url=jdbc:postgresql://localhost:5432/postgres
spring.datasource.username=postgres
spring.datasource.password=postgres