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/TagServiceImpl.java | |
parent | 73a2b1d4796ea18ef476f4ca30e2028c828d0ac1 (diff) |
Constructor injectection for service layer
Diffstat (limited to 'server-core/src/main/java/com/juick/service/TagServiceImpl.java')
-rw-r--r-- | server-core/src/main/java/com/juick/service/TagServiceImpl.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/server-core/src/main/java/com/juick/service/TagServiceImpl.java b/server-core/src/main/java/com/juick/service/TagServiceImpl.java index 3aed4b9b..d63159cf 100644 --- a/server-core/src/main/java/com/juick/service/TagServiceImpl.java +++ b/server-core/src/main/java/com/juick/service/TagServiceImpl.java @@ -3,10 +3,12 @@ package com.juick.service; import com.juick.Tag; import org.apache.commons.lang3.StringEscapeUtils; import org.springframework.dao.EmptyResultDataAccessException; +import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.GeneratedKeyHolder; import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.Assert; import javax.inject.Inject; import java.sql.PreparedStatement; @@ -27,8 +29,14 @@ public class TagServiceImpl extends BaseJdbcService implements TagService { private static final Pattern TAGS_PATTERN2 = Pattern.compile("^\\*([^ \\r\\n\\t]+)\\s+([\\s\\S]+)"); private static final Pattern TAG_PATTERN = Pattern.compile("\\*([^ \\r\\n\\t]+)"); + private final MessagesService messagesService; + @Inject - MessagesService messagesService; + public TagServiceImpl(JdbcTemplate jdbcTemplate, MessagesService messagesService) { + super(jdbcTemplate, null); + Assert.notNull(messagesService); + this.messagesService = messagesService; + } @Transactional(readOnly = true) @Override |