diff options
author | 2016-11-15 00:03:59 +0700 | |
---|---|---|
committer | 2016-11-15 09:49:27 +0300 | |
commit | 32a6feb195171e06d60117ad758cc8beb50e5ca3 (patch) | |
tree | 7e3c72fe408861e8d828f181a46816e1b200993f /server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java | |
parent | 73a2b1d4796ea18ef476f4ca30e2028c828d0ac1 (diff) |
Constructor injectection for service layer
Diffstat (limited to 'server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java')
-rw-r--r-- | server-core/src/main/java/com/juick/service/SubscriptionServiceImpl.java | 17 |
1 files changed, 14 insertions, 3 deletions
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 |