|
17 | 17 | */
|
18 | 18 | package ru.mystamps.web.feature.account;
|
19 | 19 |
|
20 |
| -import lombok.RequiredArgsConstructor; |
21 | 20 | import org.apache.commons.lang3.Validate;
|
22 |
| -import org.springframework.beans.factory.annotation.Value; |
| 21 | +import org.springframework.core.env.Environment; |
23 | 22 | import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
24 | 23 |
|
25 | 24 | import java.util.Collections;
|
|
29 | 28 | import java.util.Map;
|
30 | 29 |
|
31 | 30 | @SuppressWarnings("PMD.AvoidDuplicateLiterals")
|
32 |
| -@RequiredArgsConstructor |
33 | 31 | public class JdbcUsersActivationDao implements UsersActivationDao {
|
34 | 32 |
|
35 | 33 | private final NamedParameterJdbcTemplate jdbcTemplate;
|
| 34 | + private final String findByActivationKeySql; |
| 35 | + private final String findOlderThanDateSql; |
| 36 | + private final String countByActivationKeySql; |
| 37 | + private final String countCreatedSinceSql; |
| 38 | + private final String removeByActivationKeySql; |
| 39 | + private final String addActivationKeySql; |
36 | 40 |
|
37 |
| - @Value("${users_activation.find_by_activation_key}") |
38 |
| - private String findByActivationKeySql; |
39 |
| - |
40 |
| - @Value("${users_activation.find_older_than}") |
41 |
| - private String findOlderThanDateSql; |
42 |
| - |
43 |
| - @Value("${users_activation.count_by_activation_key}") |
44 |
| - private String countByActivationKeySql; |
45 |
| - |
46 |
| - @Value("${users_activation.count_created_since}") |
47 |
| - private String countCreatedSinceSql; |
48 |
| - |
49 |
| - @Value("${users_activation.remove_by_activation_key}") |
50 |
| - private String removeByActivationKeySql; |
51 |
| - |
52 |
| - @Value("${users_activation.create}") |
53 |
| - private String addActivationKeySql; |
| 41 | + @SuppressWarnings("checkstyle:linelength") |
| 42 | + public JdbcUsersActivationDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { |
| 43 | + this.jdbcTemplate = jdbcTemplate; |
| 44 | + this.findByActivationKeySql = env.getRequiredProperty("users_activation.find_by_activation_key"); |
| 45 | + this.findOlderThanDateSql = env.getRequiredProperty("users_activation.find_older_than"); |
| 46 | + this.countByActivationKeySql = env.getRequiredProperty("users_activation.count_by_activation_key"); |
| 47 | + this.countCreatedSinceSql = env.getRequiredProperty("users_activation.count_created_since"); |
| 48 | + this.removeByActivationKeySql = env.getRequiredProperty("users_activation.remove_by_activation_key"); |
| 49 | + this.addActivationKeySql = env.getRequiredProperty("users_activation.create"); |
| 50 | + } |
54 | 51 |
|
55 | 52 | @Override
|
56 | 53 | public UsersActivationDto findByActivationKey(String activationKey) {
|
|
0 commit comments