constructor injection instead of field injection
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
package _11.asktpk.artisanconnectbackend.controller;
|
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.service.ClientService;
|
||||||
|
import _11.asktpk.artisanconnectbackend.dto.ClientDTO;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ import java.util.List;
|
|||||||
@RequestMapping("/api/v1/notices")
|
@RequestMapping("/api/v1/notices")
|
||||||
@RestController
|
@RestController
|
||||||
public class NoticeController {
|
public class NoticeController {
|
||||||
@Autowired
|
private final NoticeService noticeService;
|
||||||
private NoticeService noticeService;
|
private final ClientService clientService;
|
||||||
|
|
||||||
@Autowired
|
public NoticeController(NoticeService noticeService, ClientService clientService) {
|
||||||
private ClientService clientService;
|
this.noticeService = noticeService;
|
||||||
|
this.clientService = clientService;
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get/all")
|
@GetMapping("/get/all")
|
||||||
public List<NoticeDTO> getAllNotices() {
|
public List<NoticeDTO> getAllNotices() {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
spring.application.name=ArtisanConnectBackend
|
spring.application.name=ArtisanConnectBackend
|
||||||
|
|
||||||
## PostgreSQL
|
## 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.username=postgres
|
||||||
spring.datasource.password=postgres
|
spring.datasource.password=postgres
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user