diff --git a/core/src/main/java/cz/muni/pa165/service/CarComponentService.java b/core/src/main/java/cz/muni/pa165/service/CarComponentService.java index c993139f9db1b35b933116a5cb1af0b69b3edc91..4e7405eafb158c9cdb973cff6bc8f64ab6128b05 100644 --- a/core/src/main/java/cz/muni/pa165/service/CarComponentService.java +++ b/core/src/main/java/cz/muni/pa165/service/CarComponentService.java @@ -4,11 +4,9 @@ import cz.muni.pa165.data.enums.ComponentTypeEnum; import cz.muni.pa165.data.model.CarComponent; import cz.muni.pa165.data.repository.CarComponentRepository; import cz.muni.pa165.exceptions.ResourceNotFoundException; -import cz.muni.pa165.rest.CarComponentController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; @@ -16,7 +14,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.*; -import java.io.IOException; import java.util.*; @Service @@ -26,9 +23,7 @@ public class CarComponentService extends DomainService<CarComponent> { private final CarComponentRepository componentRepository; private final RestTemplate restTemplate; - @Value("${http://localhost:8083/notification}") - private String notificationServiceUrl; - + private final String NOTIFICATION_MODULE_URL = "http://localhost:8083/notification"; @Autowired public CarComponentService(CarComponentRepository repository, RestTemplate restTemplate) { super(repository, CarComponent.class); @@ -41,7 +36,7 @@ public class CarComponentService extends DomainService<CarComponent> { try { sendPostRequest(savedComponent); } catch (RestClientException | IllegalArgumentException e) { - log.debug(String.format("The notification module is not reachable on the URL: %s", notificationServiceUrl)); + log.debug(String.format("The notification module is not reachable on the URL: %s", NOTIFICATION_MODULE_URL)); } return savedComponent; } @@ -55,7 +50,7 @@ public class CarComponentService extends DomainService<CarComponent> { HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); HttpEntity<Map<String, Object>> request = new HttpEntity<>(notification, headers); - restTemplate.postForObject(notificationServiceUrl, request, String.class); + restTemplate.postForObject(NOTIFICATION_MODULE_URL, request, String.class); } public CarComponent update(Long id, CarComponent component) {