Procházet zdrojové kódy

静态资源优化

chao před 3 roky
rodič
revize
d5c85bf8c5

+ 7 - 0
src/main/java/com/caimei/www/service/generate/impl/GenerateHtmlImpl.java

@@ -48,6 +48,9 @@ public class GenerateHtmlImpl implements GenerateHtml {
     /** 打包时间 */
     @Value("${spring.application.build-time}")
     private String buildTime;
+    /** 环境 */
+    @Value("${spring.profiles.active}")
+    private String profile;
 
     @Resource
     private TemplateEngine templateEngine;
@@ -120,6 +123,10 @@ public class GenerateHtmlImpl implements GenerateHtml {
      */
     @Override
     public String generateStaticFiles() {
+        if ("dev".equals(profile)){
+            log.info("[静态页服务]:本地环境不拷贝静态文件! ^_^");
+            return "[静态页服务]:本地环境不拷贝静态文件! ^_^";
+        }
         // 拷贝静态资源文件
         try {
             copyResourceToFile();

+ 1 - 2
src/main/resources/config/dev/application-dev.yml

@@ -4,7 +4,6 @@ spring:
   #数据源连接--start
   datasource:
     #本地连接数据库
-    driverClassName: com.mysql.jdbc.Driver
     url: jdbc:mysql://192.168.2.100:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
     username: developer
     password: 05bZ/OxTB:X+yd%1
@@ -60,7 +59,7 @@ caimei:
   #coreServer: http://192.168.2.75:18002
   imageDomain: https://img-b.caimei365.com
   wwwDomain: http:localhost:8009
-  destPath: D:/_PLAN_WORKSPACE/test/static
+  destPath: classpath:/
 
 
 #DFS配置