blob: e2d1c04e3c8f65ebd6434300d8b808a5d4d8ba92 [file] [log] [blame]
:moduledeps: core
= Proxy Module
:Notice: 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.
== Overview
The Proxy Module provides a simple CDI based wrapper for creating dynamic proxies that can be used within other extensions. +
The benefit of the DeltaSpike Proxy Module (compared to Javassist or any library) is that the DeltaSpike proxies will execute CDI interceptors. +
The Proxy Module also provides the 'DeltaSpikeProxyContextualLifecycle', which enables you to dynamically register a proxy as CDI bean via our 'BeanBuilder'.
=== 1. Declare Proxy Module Dependencies
Add the Proxy module to the list of dependencies in the project `pom.xml` file using this code snippet:
[source,xml]
----
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-proxy-module-api</artifactId>
<version>${deltaspike.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.deltaspike.modules</groupId>
<artifactId>deltaspike-proxy-module-impl-asm5</artifactId>
<version>${deltaspike.version}</version>
<scope>runtime</scope>
</dependency>
----
The currently provided implementation is a wrapper for ASM 5, which gets shaded into the implementation JAR.
=== 2. Extend `DeltaSpikeProxyFactory`
The key to making the proxy module work is to provide an implementation of `DeltaSpikeProxyFactory` which will do your proxy work for you. DeltaSpike ships a default one in the PartialBean module which demonstrates how its meant to work.