Use CDI producres instead of camel.beans.* in application.properties
diff --git a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java b/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java
index 40f25f2..7ece4e1 100644
--- a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java
+++ b/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java
@@ -16,10 +16,42 @@
*/
package org.apache.camel.quarkus.component.cxf.soap.it;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import com.helloworld.service.CodeFirstService;
+import com.helloworld.service.HelloPortType;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.cxf.common.message.CxfConstants;
+import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
+import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
+import org.apache.wss4j.common.ConfigurationConstants;
+import org.eclipse.microprofile.config.inject.ConfigProperty;
+@ApplicationScoped
public class CxfSoapRoutes extends RouteBuilder {
+
+ @Inject
+ @Named("passwordCallback")
+ PasswordCallback passwordCallback;
+
+ @Inject
+ @Named("loggingFeature")
+ LoggingFeature loggingFeature;
+
+ @Inject
+ @Named("wssInterceptor")
+ WSS4JOutInterceptor wssInterceptor;
+
+ @ConfigProperty(name = "wiremock.url")
+ String serviceBaseUri;
+
@Override
public void configure() {
@@ -41,4 +73,75 @@
from("cxf:bean:codeFirstServiceEndpoint")
.setBody().constant("Hello CamelQuarkusCXF");
}
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ WSS4JOutInterceptor wssInterceptor() {
+ final Map<String, Object> props = new HashMap<>();
+ props.put(ConfigurationConstants.ACTION, "UsernameToken");
+ props.put(ConfigurationConstants.PASSWORD_TYPE, "PasswordText");
+ props.put(ConfigurationConstants.USER, "camel");
+ props.put("passwordCallbackRef", passwordCallback);
+ props.put(ConfigurationConstants.ADD_USERNAMETOKEN_NONCE, "true");
+ props.put(ConfigurationConstants.ADD_USERNAMETOKEN_CREATED, "true");
+ return new WSS4JOutInterceptor(props);
+ }
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ public LoggingFeature loggingFeature() {
+ final LoggingFeature result = new LoggingFeature();
+ result.setPrettyLogging(true);
+ return result;
+ }
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ CxfEndpoint secureEndpoint() {
+ final CxfEndpoint result = new CxfEndpoint();
+ result.setServiceClass(HelloPortType.class);
+ result.setAddress(serviceBaseUri + "/hellowss");
+ result.setWsdlURL("wsdl/HelloService.wsdl");
+ result.getFeatures().add(loggingFeature);
+ result.getOutInterceptors().add(wssInterceptor);
+ return result;
+ }
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ CxfEndpoint soapClientEndpoint() {
+ final CxfEndpoint result = new CxfEndpoint();
+ result.setServiceClass(HelloPortType.class);
+ result.setAddress(serviceBaseUri + "/hello");
+ result.setWsdlURL("wsdl/HelloService.wsdl");
+ result.getFeatures().add(loggingFeature);
+ return result;
+ }
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ CxfEndpoint soapServiceEndpoint() {
+ final CxfEndpoint result = new CxfEndpoint();
+ result.setServiceClass(HelloPortType.class);
+ result.setAddress("/hello");
+ result.setWsdlURL("wsdl/HelloService.wsdl");
+ result.getFeatures().add(loggingFeature);
+ return result;
+ }
+
+ @Produces
+ @ApplicationScoped
+ @Named
+ CxfEndpoint codeFirstServiceEndpoint() {
+ final CxfEndpoint result = new CxfEndpoint();
+ result.setServiceClass(CodeFirstService.class);
+ result.setAddress("/codefirst");
+ result.getFeatures().add(loggingFeature);
+ return result;
+ }
}
diff --git a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java b/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java
index 2527932..99e86f6 100644
--- a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java
+++ b/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.camel.quarkus.component.cxf.it;
+package org.apache.camel.quarkus.component.cxf.soap.it;
import java.io.IOException;
@@ -33,9 +33,9 @@
@Named("passwordCallback")
public class PasswordCallback implements CallbackHandler {
@ConfigProperty(name = "password-callback.username")
- private String username;
+ String username;
@ConfigProperty(name = "password-callback.password")
- private String password;
+ String password;
/**
* Here, we attempt to get the password from the private alias/passwords map.
diff --git a/integration-tests/cxf-soap/src/main/resources/application.properties b/integration-tests/cxf-soap/src/main/resources/application.properties
index fb91160..efc3dcb 100644
--- a/integration-tests/cxf-soap/src/main/resources/application.properties
+++ b/integration-tests/cxf-soap/src/main/resources/application.properties
@@ -18,42 +18,5 @@
password-callback.username=camel
password-callback.password=quarkus
-camel.beans.wssArgs=#class:java.util.HashMap
-camel.beans.wssArgs.action=UsernameToken
-camel.beans.wssArgs.passwordType=PasswordText
-camel.beans.wssArgs.user=camel
-camel.beans.wssArgs.passwordCallbackRef=#bean:passwordCallback
-camel.beans.wssArgs.addUsernameTokenNonce=true
-camel.beans.wssArgs.addUsernameTokenCreated=true
-
-camel.beans.wssInterceptor=#class:org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor(#bean:wssArgs)
-
-camel.beans.loggingFeature=#class:org.apache.cxf.ext.logging.LoggingFeature
-camel.beans.loggingFeature.prettyLogging=true
-
-camel.beans.secureEndpoint=#class:org.apache.camel.component.cxf.jaxws.CxfEndpoint
-camel.beans.secureEndpoint.serviceClass=com.helloworld.service.HelloPortType
-camel.beans.secureEndpoint.address=${wiremock.url}/hellowss
-camel.beans.secureEndpoint.wsdlURL=wsdl/HelloService.wsdl
-camel.beans.secureEndpoint.features[0]=#bean:loggingFeature
-camel.beans.secureEndpoint.outInterceptors[0]=#bean:wssInterceptor
-
-camel.beans.soapClientEndpoint=#class:org.apache.camel.component.cxf.jaxws.CxfEndpoint
-camel.beans.soapClientEndpoint.serviceClass=com.helloworld.service.HelloPortType
-camel.beans.soapClientEndpoint.address=${wiremock.url}/hello
-camel.beans.soapClientEndpoint.wsdlURL=wsdl/HelloService.wsdl
-camel.beans.soapClientEndpoint.features[0]=#bean:loggingFeature
-
-camel.beans.soapServiceEndpoint=#class:org.apache.camel.component.cxf.jaxws.CxfEndpoint
-camel.beans.soapServiceEndpoint.serviceClass=com.helloworld.service.HelloPortType
-camel.beans.soapServiceEndpoint.address=/hello
-camel.beans.soapServiceEndpoint.wsdlURL=wsdl/HelloService.wsdl
-camel.beans.soapServiceEndpoint.features[0]=#bean:loggingFeature
-
-camel.beans.codeFirstServiceEndpoint=#class:org.apache.camel.component.cxf.jaxws.CxfEndpoint
-camel.beans.codeFirstServiceEndpoint.serviceClass=com.helloworld.service.CodeFirstService
-camel.beans.codeFirstServiceEndpoint.address=/codefirst
-camel.beans.codeFirstServiceEndpoint.features[0]=#bean:loggingFeature
-
quarkus.cxf.path=/soapservice
quarkus.native.resources.includes = wsdl/*.wsdl