Ver Fonte

避免ehcache配置文件一直被占用,无法完全销毁项目重新部署

RuoYi há 6 anos atrás
pai
commit
af64be2a31

+ 7 - 8
ruoyi-admin/src/main/resources/static/css/login.css

@@ -85,20 +85,19 @@ body.signin {
 }
 }
 /*
-登录界面check样式
-*/ 
+鐧诲綍鐣岄潰check鏍峰紡
+*/
 .checkbox-custom {
     position: relative;
     padding: 0 15px 0 25px;
     margin-bottom: 7px;
-    margin-top: 0;
     display: inline-block;
 }
 /*
-将初始的checkbox的样式改变
+灏嗗垵濮嬬殑checkbox鐨勬牱寮忔敼鍙�
 */
 .checkbox-custom input[type="checkbox"] {
-    opacity: 0;/*将初始的checkbox隐藏起来*/
+    opacity: 0; /*灏嗗垵濮嬬殑checkbox闅愯棌璧锋潵*/
     position: absolute;
     cursor: pointer;
     z-index: 2;
@@ -107,7 +106,7 @@ body.signin {
     left: 3px;
 }
 /*
-设计新的checkbox,位置
+璁捐�鏂扮殑checkbox锛屼綅缃�
 */
 .checkbox-custom label:before {
     content: '';
@@ -123,7 +122,7 @@ body.signin {
     background: #fff;
 }
 /*
-点击初始的checkbox,将新的checkbox关联起来
+鐐瑰嚮鍒濆�鐨刢heckbox锛屽皢鏂扮殑checkbox鍏宠仈璧锋潵
 */
 .checkbox-custom input[type="checkbox"]:checked +label:after {
     position: absolute;
@@ -142,7 +141,7 @@ body.signin {
 .checkbox-custom label {
     cursor: pointer;
     line-height: 1.2;
-    font-weight: normal;/*改变了rememberme的字体*/
+    font-weight: normal; /*鏀瑰彉浜唕ememberme鐨勫瓧浣�*/
     margin-bottom: 0;
     text-align: left;
 }

Diff do ficheiro suprimidas por serem muito extensas
+ 0 - 0
ruoyi-admin/src/main/resources/static/css/login.min.css


+ 1 - 1
ruoyi-admin/src/main/resources/templates/login.html

@@ -59,7 +59,7 @@
 							</a>
 						</div>
 					</div>
-                    <div class="checkbox-custom" th:class="${captchaEnabled==false}? 'm-t'">
+                    <div class="checkbox-custom" th:classappend="${captchaEnabled==false} ? 'm-t'">
 				        <input type="checkbox" id="rememberme" name="rememberme"> <label for="rememberme">记住我</label>
 				    </div>
                     <button class="btn btn-success btn-block" id="btnSubmit" data-loading="正在验证登录,请稍后...">登录</button>

+ 32 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/ShiroConfig.java

@@ -1,10 +1,16 @@
 package com.ruoyi.framework.config;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import javax.servlet.Filter;
+import org.apache.commons.io.IOUtils;
 import org.apache.shiro.cache.ehcache.EhCacheManager;
 import org.apache.shiro.codec.Base64;
+import org.apache.shiro.config.ConfigurationException;
+import org.apache.shiro.io.ResourceUtils;
 import org.apache.shiro.mgt.SecurityManager;
 import org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor;
 import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
@@ -87,7 +93,7 @@ public class ShiroConfig
         EhCacheManager em = new EhCacheManager();
         if (StringUtils.isNull(cacheManager))
         {
-            em.setCacheManagerConfigFile("classpath:ehcache/ehcache-shiro.xml");
+            em.setCacheManager(new net.sf.ehcache.CacheManager(getCacheManagerConfigFileInputStream()));
             return em;
         }
         else
@@ -97,6 +103,31 @@ public class ShiroConfig
         }
     }
 
+    /**
+     * 返回配置文件流 避免ehcache配置文件一直被占用,无法完全销毁项目重新部署
+     */
+    protected InputStream getCacheManagerConfigFileInputStream()
+    {
+        String configFile = "classpath:ehcache/ehcache-shiro.xml";
+        InputStream inputStream = null;
+        try
+        {
+            inputStream = ResourceUtils.getInputStreamForPath(configFile);
+            byte[] b = IOUtils.toByteArray(inputStream);
+            InputStream in = new ByteArrayInputStream(b);
+            return in;
+        }
+        catch (IOException e)
+        {
+            throw new ConfigurationException(
+                    "Unable to obtain input stream for cacheManagerConfigFile [" + configFile + "]", e);
+        }
+        finally
+        {
+            IOUtils.closeQuietly(inputStream);
+        }
+    }
+
     /**
      * 自定义Realm
      */

Alguns ficheiros não foram mostrados porque muitos ficheiros mudaram neste diff