I am using this project in the pom of my application:
<dependency>
<groupId>com.girotan.notification</groupId>
<artifactId>notification-service-rest-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Within a service I use an @Service class of the mentioned project NotificationRestClient
, like this:
void sendEmailNotificationMessage(ApiEmailNotification apiEmailNotification) throws BusinessException {
NotificationEnvelope notificationEnvelope = new NotificationEnvelope();
notificationEnvelope.setType(ApiNotificationType.EMAIL);
notificationEnvelope.setNotification(apiEmailNotification);
NotificationRestClient restClient = new NotificationRestClient();
restClient.send(notificationEnvelope);
}
However this seems inelegant to me, I am using spring. Is there a way to inject NotificationRestClient restClient
and not instantiate it as an object?