|
17 | 17 | */
|
18 | 18 | package ru.mystamps.web.feature.series.importing.extractor;
|
19 | 19 |
|
20 |
| -import lombok.RequiredArgsConstructor; |
21 |
| -import org.springframework.beans.factory.annotation.Value; |
| 20 | +import org.springframework.core.env.Environment; |
22 | 21 | import org.springframework.dao.EmptyResultDataAccessException;
|
23 | 22 | import org.springframework.jdbc.core.ResultSetExtractor;
|
24 | 23 | import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
|
28 | 27 | import java.util.List;
|
29 | 28 | import java.util.Map;
|
30 | 29 |
|
31 |
| -@RequiredArgsConstructor |
32 | 30 | public class JdbcSiteParserDao implements SiteParserDao {
|
33 | 31 |
|
34 | 32 | private static final ResultSetExtractor<Map<String, String>> PARAMS_EXTRACTOR =
|
35 | 33 | new MapStringStringResultSetExtractor("name", "value");
|
36 | 34 |
|
37 | 35 | private final NamedParameterJdbcTemplate jdbcTemplate;
|
38 |
| - |
39 |
| - @Value("${site_parser.find_like_matched_url}") |
40 |
| - private String findParserIdByMatchedUrlSql; |
41 |
| - |
42 |
| - @Value("${site_parser.find_names}") |
43 |
| - private String findParserNamesSql; |
44 |
| - |
| 36 | + private final String findParserIdByMatchedUrlSql; |
| 37 | + private final String findParserNamesSql; |
45 | 38 | @SuppressWarnings("PMD.LongVariable")
|
46 |
| - @Value("${site_parser_param.find_all_with_parser_name}") |
47 |
| - private String findParametersWithParserNameSql; |
| 39 | + private final String findParametersWithParserNameSql; |
| 40 | + |
| 41 | + @SuppressWarnings("checkstyle:linelength") |
| 42 | + public JdbcSiteParserDao(Environment env, NamedParameterJdbcTemplate jdbcTemplate) { |
| 43 | + this.jdbcTemplate = jdbcTemplate; |
| 44 | + this.findParserIdByMatchedUrlSql = env.getRequiredProperty("site_parser.find_like_matched_url"); |
| 45 | + this.findParserNamesSql = env.getRequiredProperty("site_parser.find_names"); |
| 46 | + this.findParametersWithParserNameSql = env.getRequiredProperty("site_parser_param.find_all_with_parser_name"); |
| 47 | + } |
48 | 48 |
|
49 | 49 | @Override
|
50 | 50 | public Integer findParserIdForUrl(String url) {
|
|
0 commit comments