You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2018/11/21 06:57:36 UTC
incubator-tamaya-extensions git commit: Added missing file headers
and deps.
Repository: incubator-tamaya-extensions
Updated Branches:
refs/heads/master b82c4dc5b -> beb355543
Added missing file headers and deps.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/beb35554
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/beb35554
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/beb35554
Branch: refs/heads/master
Commit: beb355543058dfe3a23414b0956bc8c21b99b13e
Parents: b82c4dc
Author: Anatole Tresch <at...@gmail.com>
Authored: Wed Nov 21 07:57:12 2018 +0100
Committer: Anatole Tresch <at...@gmail.com>
Committed: Wed Nov 21 07:57:12 2018 +0100
----------------------------------------------------------------------
.../tamaya/inject/internal/InjectionHelper.java | 7 +---
modules/spring/pom.xml | 7 ++++
.../tamaya/integration/spring/EndpointBean.java | 40 ++++++++++++++++++++
.../integration/spring/MyApplication.java | 36 ++++++++++++++++++
4 files changed, 85 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/beb35554/modules/injection/standalone/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
----------------------------------------------------------------------
diff --git a/modules/injection/standalone/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java b/modules/injection/standalone/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
index e207819..ba37bdd 100644
--- a/modules/injection/standalone/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
+++ b/modules/injection/standalone/src/main/java/org/apache/tamaya/inject/internal/InjectionHelper.java
@@ -38,10 +38,7 @@ import org.apache.tamaya.inject.spi.InjectionUtils;
import org.apache.tamaya.inject.api.WithPropertyConverter;
import org.apache.tamaya.inject.spi.ConfiguredType;
import org.apache.tamaya.resolver.spi.ExpressionEvaluator;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.spi.*;
/**
@@ -225,7 +222,7 @@ final class InjectionHelper {
ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext(classLoader)
.getService(ExpressionEvaluator.class);
if (evaluator != null) {
- return evaluator.evaluateExpression("<injection>", expression, true);
+ return evaluator.evaluateExpression(PropertyValue.createValue("<injection>", expression), true).getValue();
}
return expression;
}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/beb35554/modules/spring/pom.xml
----------------------------------------------------------------------
diff --git a/modules/spring/pom.xml b/modules/spring/pom.xml
index b2df0de..f6c166b 100644
--- a/modules/spring/pom.xml
+++ b/modules/spring/pom.xml
@@ -108,6 +108,13 @@ under the License.
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter</artifactId>
+ <version>2.0.4.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/beb35554/modules/spring/src/test/java/org/apache/tamaya/integration/spring/EndpointBean.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/tamaya/integration/spring/EndpointBean.java b/modules/spring/src/test/java/org/apache/tamaya/integration/spring/EndpointBean.java
new file mode 100644
index 0000000..ab511ea
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/tamaya/integration/spring/EndpointBean.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.spring;
+
+import org.apache.tamaya.inject.api.Config;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.PostConstruct;
+import java.net.URL;
+
+@Component
+public class EndpointBean {
+
+ @Config(value = "server.endpoint", defaultValue = "http://localhost:8000/ass_s/v1")
+ private URL endpoint;
+
+ @PostConstruct
+ public void connect() {
+ // connect to the server
+ }
+
+ // ...
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/beb35554/modules/spring/src/test/java/org/apache/tamaya/integration/spring/MyApplication.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/test/java/org/apache/tamaya/integration/spring/MyApplication.java b/modules/spring/src/test/java/org/apache/tamaya/integration/spring/MyApplication.java
new file mode 100644
index 0000000..cc78815
--- /dev/null
+++ b/modules/spring/src/test/java/org/apache/tamaya/integration/spring/MyApplication.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.integration.spring;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ApplicationContext;
+import org.springframework.test.context.ContextConfiguration;
+
+@SpringBootApplication
+@ContextConfiguration(classes=TamayaSpringConfig.class)
+public class MyApplication {
+
+ public static void main (String[] args) {
+ ApplicationContext context =
+ SpringApplication.run(MyApplication.class, args);
+
+ }
+
+}