记录项目配置,修改配置项的获取方式

- new class ` CommonEnvPostProcessor `
- remove ` @value `
- make JwtUtil's method static
This commit is contained in:
禾几海
2021-10-01 17:48:42 +08:00
parent 07e84ab875
commit 5a00e6c62f
17 changed files with 175 additions and 104 deletions

View File

@@ -4,8 +4,8 @@ package cn.celess.article.util;
import cn.celess.common.entity.Article;
import cn.celess.common.mapper.ArticleMapper;
import cn.celess.common.util.DateFormatUtil;
import cn.celess.common.util.EnvironmentUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
@@ -38,9 +38,6 @@ public class SitemapGenerateUtil {
@Autowired
ArticleMapper articleMapper;
@Value("${sitemap.path}")
private String path;
private Map<String, String> urlList;
private static DocumentBuilder getDocumentBuilder() {
@@ -57,7 +54,8 @@ public class SitemapGenerateUtil {
@Async
public void createSitemap() {
initList();
if ("".equals(path) || "classpath".equals(path)) {
String path = EnvironmentUtil.getProperties("sitemap.path", System.getProperty("user.dir"));
if ("classpath".equals(path)) {
path = System.getProperty("user.dir") + "/sitemap.xml";
}
File file = new File(path);