You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2016/12/03 16:37:37 UTC

[11/50] tomee git commit: way to configure the Configuration of tomee embedded in TomEEEmbeddedApplicationRunner + using system properties too

way to configure the Configuration of tomee embedded in TomEEEmbeddedApplicationRunner + using system properties too


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/dafe6d28
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/dafe6d28
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/dafe6d28

Branch: refs/heads/tomee-1.7.x
Commit: dafe6d287875f63ea16cd466110a83e1023f1fb2
Parents: d552210
Author: rmannibucau <rm...@apache.org>
Authored: Fri Sep 30 15:13:48 2016 +0200
Committer: rmannibucau <rm...@apache.org>
Committed: Fri Sep 30 15:13:48 2016 +0200

----------------------------------------------------------------------
 .../tomee/embedded/TomEEEmbeddedApplicationRunner.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/dafe6d28/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
index 91755af..c16b970 100644
--- a/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
+++ b/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/TomEEEmbeddedApplicationRunner.java
@@ -117,10 +117,20 @@ public class TomEEEmbeddedApplicationRunner implements AutoCloseable {
         final Configuration configuration = new Configuration();
         final ContainerProperties props = appClass.getAnnotation(ContainerProperties.class);
         if (props != null) {
+            final Properties runnerProperties = new Properties();
             for (final ContainerProperties.Property p : props.value()) {
-                configuration.property(p.name(), p.value());
+                final String name = p.name();
+                if (name.startsWith("tomee.embedded.application.runner.")) { // allow to tune the Configuration
+                    runnerProperties.setProperty(name.substring("tomee.embedded.application.runner.".length()), p.value());
+                } else {
+                    configuration.property(name, p.value());
+                }
+            }
+            if (!runnerProperties.isEmpty()) {
+                configuration.loadFromProperties(runnerProperties);
             }
         }
+        configuration.loadFromProperties(System.getProperties()); // overrides, note that some config are additive by design
 
         final List<Method> annotatedMethods = finder.findAnnotatedMethods(org.apache.openejb.testing.Configuration.class);
         if (annotatedMethods.size() > 1) {