From 32a6feb195171e06d60117ad758cc8beb50e5ca3 Mon Sep 17 00:00:00 2001 From: Alexander Alexeev Date: Tue, 15 Nov 2016 00:03:59 +0700 Subject: Constructor injectection for service layer --- .../java/com/juick/service/SubscriptionServiceImpl.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java') diff --git a/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 57d52cbf..2bf05796 100644 --- a/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -4,8 +4,10 @@ import com.juick.Tag; import com.juick.User; import com.juick.server.helpers.NotifyOpts; import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; import org.springframework.util.StringUtils; import javax.inject.Inject; @@ -17,10 +19,19 @@ import java.util.stream.Collectors; */ @Repository public class SubscriptionServiceImpl extends BaseJdbcService implements SubscriptionService { + private final UserService userService; + private final MessagesService messagesService; + @Inject - UserService userService; - @Inject - MessagesService messagesService; + public SubscriptionServiceImpl(JdbcTemplate jdbcTemplate, UserService userService, MessagesService messagesService) { + super(jdbcTemplate, null); + + Assert.notNull(userService); + this.userService = userService; + + Assert.notNull(messagesService); + this.messagesService = messagesService; + } @Transactional(readOnly = true) @Override -- cgit v1.2.3