A patch given to the public domain.. If you give credit, please credit
Johnathan E. James. And send me an email :) Thanks.

Index: src/main/java/org/apache/shiro/config/ReflectionBuilder.java
===================================================================
--- src/main/java/org/apache/shiro/config/ReflectionBuilder.java        
(revision
1593866)
+++ src/main/java/org/apache/shiro/config/ReflectionBuilder.java        (working
copy)
@@ -95,6 +95,20 @@
         return (T) bean;
     }
 
+    private String getValue(String str) {
+       String rtn = str;
+       
+       int beginIndex = str.indexOf("${");
+       int endIndex = str.indexOf("}");
+       
+       if ((beginIndex == 0) && (endIndex == str.length() - 1)) {
+               String propertyName = str.substring(2, endIndex);
+               rtn = System.getProperty(propertyName);
+       }
+       
+       return rtn;
+    }
+
     @SuppressWarnings({"unchecked"})
     public Map<String, ?> buildObjects(Map<String, String> kvPairs) {
         if (kvPairs != null && !kvPairs.isEmpty()) {
@@ -116,12 +130,12 @@
 
             // Create all instances
             for (Map.Entry<String, String> entry : instanceMap.entrySet())
{
-                createNewInstance((Map<String, Object>) objects,
entry.getKey(), entry.getValue());
+                createNewInstance((Map<String, Object>) objects,
entry.getKey(), getValue(entry.getValue()));
             }
 
             // Set all properties
             for (Map.Entry<String, String> entry : propertyMap.entrySet())
{
-                applyProperty(entry.getKey(), entry.getValue(), objects);
+                applyProperty(entry.getKey(), getValue(entry.getValue()),
objects);
             }
         }
 




--
View this message in context: 
http://shiro-user.582556.n2.nabble.com/System-properties-in-shiro-ini-tp7579627p7579946.html
Sent from the Shiro User mailing list archive at Nabble.com.

Reply via email to