deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [2/2] deltaspike git commit: DELTASPIKE-823 Reimplement Partial-Bean module
Date Fri, 13 Feb 2015 13:16:17 GMT
DELTASPIKE-823 Reimplement Partial-Bean module


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

Branch: refs/heads/master
Commit: e58890b55bf88345069ecafa5859db14be2bd6ae
Parents: cdefea9
Author: tandraschko <tandraschko@apache.org>
Authored: Fri Feb 13 14:12:37 2015 +0100
Committer: tandraschko <tandraschko@apache.org>
Committed: Fri Feb 13 14:12:37 2015 +0100

----------------------------------------------------------------------
 .../spi/AbstractPartialBeanProvider.java        |  43 +++
 .../partialbean/spi/PartialBeanBuilder.java     |  68 ++++
 .../partialbean/spi/PartialBeanDescriptor.java  |  96 +++++
 .../partialbean/spi/PartialBeanProvider.java    |  36 ++
 deltaspike/modules/partial-bean/impl/pom.xml    |  56 ++-
 .../impl/ASMProxyClassGenerator.java            | 354 +++++++++++++++++++
 .../partialbean/impl/MethodHandlerProxy.java    |  42 ---
 .../impl/PartialBeanAbstractMethodHandler.java  |  46 ---
 .../impl/PartialBeanBindingExtension.java       | 249 +++++++++----
 .../partialbean/impl/PartialBeanLifecycle.java  | 170 +++------
 .../partialbean/impl/PartialBeanProxy.java      |  28 ++
 .../impl/PartialBeanProxyFactory.java           | 178 ++++++++++
 .../ThrowExceptionPartialBeanBinding.java       |  35 ++
 .../ThrowExceptionPartialBeanHandler.java       |  34 ++
 .../uc002/PartialBeanAsAbstractClassTest.java   |  11 -
 .../api/partialbean/uc004/AbstractSuper.java    |  24 ++
 .../uc004/ApplicationScopedPartialBean.java     |   4 +-
 .../uc004/ScopedPartialBeanTest.java            |  10 -
 .../api/partialbean/uc004/SuperInterface.java   |  24 ++
 .../api/partialbean/uc005/AbstractSuper.java    |  24 ++
 .../uc005/ApplicationScopedPartialBean.java     |  37 ++
 .../uc005/ScopedPartialBeanTest.java            |  85 +++++
 .../api/partialbean/uc005/SuperInterface.java   |  24 ++
 .../api/partialbean/uc006/AbstractSuper.java    |  31 ++
 .../partialbean/uc006/AbstractSuperSuper.java   |  27 ++
 .../uc006/ApplicationScopedPartialBean.java     |  36 ++
 .../uc006/ScopedPartialBeanTest.java            |  75 ++++
 .../core/api/partialbean/uc007/PartialBean.java |  66 ++++
 ...lBeanAsAbstractClassWithInterceptorTest.java |  95 +++++
 .../uc007/TestPartialBeanProvider.java          |  32 ++
 .../core/api/partialbean/util/ArchiveUtils.java |  23 +-
 31 files changed, 1750 insertions(+), 313 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/AbstractPartialBeanProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/AbstractPartialBeanProvider.java b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/AbstractPartialBeanProvider.java
new file mode 100644
index 0000000..71800cb
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/AbstractPartialBeanProvider.java
@@ -0,0 +1,43 @@
+/*
+ * 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.deltaspike.partialbean.spi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public abstract class AbstractPartialBeanProvider implements PartialBeanProvider
+{
+    private final ArrayList<PartialBeanDescriptor> descriptors = new ArrayList<PartialBeanDescriptor>();
+    
+    @Override
+    public List<PartialBeanDescriptor> get()
+    {
+        return descriptors;
+    }
+    
+    protected void add(PartialBeanDescriptor partialBeanDescriptor)
+    {
+        descriptors.add(partialBeanDescriptor);
+    }
+    
+    protected void add(PartialBeanBuilder partialBeanBuilder)
+    {
+        descriptors.add(partialBeanBuilder.create());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanBuilder.java b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanBuilder.java
new file mode 100644
index 0000000..dda52b8
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanBuilder.java
@@ -0,0 +1,68 @@
+/*
+ * 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.deltaspike.partialbean.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+public class PartialBeanBuilder
+{
+    private final Class<? extends Annotation> binding;
+    private final Class<? extends InvocationHandler> handler;
+    private final ArrayList<Class<?>> classes;
+    
+    public PartialBeanBuilder(Class<? extends Annotation> bindingClass, Class<? extends InvocationHandler> handlerClass)
+    {
+        this.binding = bindingClass;
+        this.handler = handlerClass;
+        
+        this.classes = new ArrayList<Class<?>>();
+    }
+    
+    public PartialBeanBuilder(Class<? extends Annotation> bindingClass, Class<? extends InvocationHandler> handlerClass,
+            Class<?>... classes)
+    {
+        this.binding = bindingClass;
+        this.handler = handlerClass;
+        
+        this.classes = new ArrayList<Class<?>>();
+        this.classes.addAll(Arrays.asList(classes));
+    }
+    
+    public PartialBeanBuilder addClass(Class<?> classToAdd)
+    {
+        classes.add(classToAdd);
+        
+        return this;
+    }
+    
+    public PartialBeanBuilder addClasses(Class<?>... classesToAdd)
+    {
+        classes.addAll(Arrays.asList(classesToAdd));
+        
+        return this;
+    }
+    
+    public PartialBeanDescriptor create()
+    {
+        return new PartialBeanDescriptor(binding, handler, classes);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanDescriptor.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanDescriptor.java b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanDescriptor.java
new file mode 100644
index 0000000..19e9f37
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanDescriptor.java
@@ -0,0 +1,96 @@
+/*
+ * 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.deltaspike.partialbean.spi;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class PartialBeanDescriptor
+{
+    private Class<? extends Annotation> binding;
+    private Class<? extends InvocationHandler> handler;
+    private List<Class<?>> classes;
+
+    public PartialBeanDescriptor(Class<? extends Annotation> binding)
+    {
+        this.binding = binding;
+    }
+
+    public PartialBeanDescriptor(Class<? extends Annotation> binding,
+            Class<? extends InvocationHandler> handler)
+    {
+        this.binding = binding;
+        this.handler = handler;
+    }
+
+    public PartialBeanDescriptor(Class<? extends Annotation> binding,
+            Class<? extends InvocationHandler> handler,
+            Class<?>... classes)
+    {
+        this.binding = binding;
+        this.handler = handler;
+        this.classes = new ArrayList<Class<?>>();
+        if (classes.length > 0)
+        {
+            this.classes.addAll(Arrays.asList(classes));
+        }
+    }
+
+    public PartialBeanDescriptor(Class<? extends Annotation> binding,
+            Class<? extends InvocationHandler> handler,
+            List<Class<?>> classes)
+    {
+        this.binding = binding;
+        this.handler = handler;
+        this.classes = classes;
+    }
+
+    public Class<? extends Annotation> getBinding()
+    {
+        return binding;
+    }
+
+    public void setBinding(Class<? extends Annotation> binding)
+    {
+        this.binding = binding;
+    }
+
+    public Class<? extends InvocationHandler> getHandler()
+    {
+        return handler;
+    }
+
+    public void setHandler(Class<? extends InvocationHandler> handler)
+    {
+        this.handler = handler;
+    }
+
+    public List<Class<?>> getClasses()
+    {
+        return classes;
+    }
+
+    public void setClasses(List<Class<?>> classes)
+    {
+        this.classes = classes;
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanProvider.java b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanProvider.java
new file mode 100644
index 0000000..04ffc76
--- /dev/null
+++ b/deltaspike/modules/partial-bean/api/src/main/java/org/apache/deltaspike/partialbean/spi/PartialBeanProvider.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.deltaspike.partialbean.spi;
+
+import java.util.List;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+
+/**
+ * The PartialBeanProvider allows to register a partial bean in BeforeBeanDiscovery as a completely new AnnotatedType,
+ * to enable interceptors on the provided partial beans.
+ *
+ * Partial beans which will be collected later in ProcessAnnotatedType can't be intercepted.
+ *
+ * If other/new partial beans will be found later via ProcessAnnotatedType, they will be merged with the early provided
+ * partial beans from the PartialBeanProvider's.
+ */
+public interface PartialBeanProvider extends Deactivatable
+{
+    List<PartialBeanDescriptor> get();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/pom.xml b/deltaspike/modules/partial-bean/impl/pom.xml
index cf29978..0304fbd 100644
--- a/deltaspike/modules/partial-bean/impl/pom.xml
+++ b/deltaspike/modules/partial-bean/impl/pom.xml
@@ -48,6 +48,43 @@
         </deltaspike.osgi.provide.capability>
     </properties>
 
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-shade-plugin</artifactId>
+                <version>2.3</version>
+                <configuration>
+                    <shadedArtifactAttached>false</shadedArtifactAttached>
+                    <createDependencyReducedPom>false</createDependencyReducedPom>
+                    <promoteTransitiveDependencies>true</promoteTransitiveDependencies>
+                    <relocations>
+                        <relocation>
+                            <pattern>org.objectweb.asm</pattern>
+                            <shadedPattern>org.apache.deltaspike.partialbean.impl.asm5</shadedPattern>
+                        </relocation>
+                    </relocations>
+                    <artifactSet>
+                        <includes>
+                            <include>org.ow2.asm:asm</include>
+                            <include>org.ow2.asm:asm-commons</include>
+                            <include>org.ow2.asm:asm-tree</include>
+                        </includes>
+                    </artifactSet>
+                </configuration>
+                <executions>
+                    <execution>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>shade</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
     <dependencies>
         <dependency>
             <groupId>org.apache.deltaspike.core</groupId>
@@ -60,9 +97,22 @@
         </dependency>
 
         <dependency>
-            <groupId>javassist</groupId>
-            <artifactId>javassist</artifactId>
-            <scope>test</scope>
+            <groupId>org.ow2.asm</groupId>
+            <artifactId>asm</artifactId>
+            <version>5.0.3</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.ow2.asm</groupId>
+            <artifactId>asm-commons</artifactId>
+            <version>5.0.3</version>
+            <optional>true</optional>
+        </dependency>
+        <dependency>
+            <groupId>org.ow2.asm</groupId>
+            <artifactId>asm-tree</artifactId>
+            <version>5.0.3</version>
+            <optional>true</optional>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/ASMProxyClassGenerator.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/ASMProxyClassGenerator.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/ASMProxyClassGenerator.java
new file mode 100644
index 0000000..f8292dd
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/ASMProxyClassGenerator.java
@@ -0,0 +1,354 @@
+/*
+ * 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.deltaspike.partialbean.impl;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.util.Arrays;
+import javax.enterprise.inject.Typed;
+import javax.inject.Inject;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Label;
+import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.commons.GeneratorAdapter;
+import org.objectweb.asm.commons.Method;
+
+@Typed
+public abstract class ASMProxyClassGenerator
+{
+    private static final String FIELDNAME_HANDLER = "__handler";
+
+    private static final Type TYPE_CLASS = Type.getType(Class.class);
+    private static final Type TYPE_OBJECT = Type.getType(Object.class);
+
+    private ASMProxyClassGenerator()
+    {
+        // prevent instantiation
+    }
+
+    public static <T> Class<T> generateProxyClass(ClassLoader classLoader,
+            Class<T> targetClass,
+            Class<? extends InvocationHandler> invocationHandlerClass,
+            String suffix,
+            java.lang.reflect.Method[] methodsToProxy)
+    {
+        String proxyName = targetClass.getCanonicalName() + suffix;
+        String classFileName = proxyName.replace('.', '/');
+
+        byte[] proxyBytes = generateProxyClassBytes(targetClass, invocationHandlerClass,
+                classFileName, methodsToProxy);
+        Class<T> proxyClass = (Class<T>) loadClass(classLoader, proxyName, proxyBytes);
+
+        return proxyClass;
+    }
+
+    private static byte[] generateProxyClassBytes(Class<?> targetClass,
+            Class<? extends InvocationHandler> invocationHandlerClass,
+            String proxyName,
+            java.lang.reflect.Method[] methods)
+    {
+        Class<?> superClass = targetClass;
+        String[] interfaces = new String[] { };
+
+        if (targetClass.isInterface())
+        {
+            superClass = Object.class;
+            interfaces = new String[] { Type.getInternalName(targetClass) };
+        }
+
+        // add PartialBeanProxy as interface
+        interfaces = Arrays.copyOf(interfaces, interfaces.length + 1);
+        interfaces[interfaces.length - 1] = Type.getInternalName(PartialBeanProxy.class);
+        
+        Type superType = Type.getType(superClass);
+        Type proxyType = Type.getObjectType(proxyName);
+        Type invocationHandlerType = Type.getType(invocationHandlerClass);
+
+        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
+        cw.visit(Opcodes.V1_6, Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER, proxyType.getInternalName(), null,
+                superType.getInternalName(), interfaces);
+
+        // copy annotations
+        for (Annotation annotation : targetClass.getDeclaredAnnotations())
+        {
+            cw.visitAnnotation(Type.getDescriptor(annotation.annotationType()), true).visitEnd();
+        }
+
+        addInvocationHandlerField(cw, invocationHandlerType);
+        addDefaultConstructor(cw, proxyType, superType);
+        addPartialBeanProxyMethods(cw, proxyType, invocationHandlerType);
+        
+        for (java.lang.reflect.Method method : methods)
+        {
+            overwriteMethod(cw, method, proxyType, invocationHandlerType);
+        }
+
+        return cw.toByteArray();
+    }
+
+    private static void addInvocationHandlerField(ClassWriter cw, Type invocationHandlerType)
+    {
+        // generates the following:
+        // @Inject private MyPartialBeanInvocationHandler __handler;
+        cw.visitField(Opcodes.ACC_PRIVATE, FIELDNAME_HANDLER, invocationHandlerType.getDescriptor(),null, null)
+                .visitAnnotation(Type.getDescriptor(Inject.class), true)
+                .visitEnd();
+    }
+
+    private static void addDefaultConstructor(ClassWriter cw, Type proxyType, Type superType)
+    {
+        GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC,
+                new Method("<init>", Type.VOID_TYPE, new Type[]{ }),
+                null,
+                null,
+                cw);
+
+        mg.visitCode();
+
+        // invoke super constructor
+        mg.loadThis();
+        mg.invokeConstructor(superType, Method.getMethod("void <init> ()"));
+
+        mg.returnValue();
+        mg.endMethod();
+        mg.visitEnd();
+    }
+
+    private static void addPartialBeanProxyMethods(ClassWriter cw, Type proxyType, Type invocationHandlerType)
+    {
+        try
+        {
+            // implement #setHandler
+            Method asmMethod =
+                    Method.getMethod(PartialBeanProxy.class.getDeclaredMethod("setHandler", InvocationHandler.class));
+            GeneratorAdapter mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);
+
+            mg.visitCode();
+
+            mg.visitVarInsn(Opcodes.ALOAD, 0);
+            mg.visitVarInsn(Opcodes.ALOAD, 1);
+            mg.visitTypeInsn(Opcodes.CHECKCAST, invocationHandlerType.getInternalName());
+            mg.visitFieldInsn(Opcodes.PUTFIELD, proxyType.getInternalName(), FIELDNAME_HANDLER,
+                    invocationHandlerType.getDescriptor());
+
+            mg.visitInsn(Opcodes.RETURN);
+            mg.visitMaxs(2, 1);
+            mg.visitEnd();
+
+
+            // implement #getHandler
+            asmMethod = Method.getMethod(PartialBeanProxy.class.getDeclaredMethod("getHandler"));
+            mg = new GeneratorAdapter(Opcodes.ACC_PUBLIC, asmMethod, null, null, cw);
+
+            mg.visitCode();
+
+            mg.visitVarInsn(Opcodes.ALOAD, 0);
+            mg.visitFieldInsn(Opcodes.GETFIELD, proxyType.getInternalName(), FIELDNAME_HANDLER,
+                    invocationHandlerType.getDescriptor());
+
+            mg.visitInsn(Opcodes.ARETURN);
+            mg.visitMaxs(2, 1);
+            mg.visitEnd();
+        }
+        catch (NoSuchMethodException e)
+        {
+            throw new IllegalStateException("Unable to implement " + PartialBeanProxy.class.getName(), e);
+        }
+    }
+    
+    private static void overwriteMethod(ClassWriter cw, java.lang.reflect.Method method, Type proxyType,
+            Type invocationHandlerType)
+    {
+        Type methodType = Type.getType(method);
+        Type[] exceptionTypes = getTypes(method.getExceptionTypes());
+
+        // push the method definition
+        int modifiers = (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED) & method.getModifiers();
+        Method asmMethod = Method.getMethod(method);
+        GeneratorAdapter mg = new GeneratorAdapter(modifiers, asmMethod, null, exceptionTypes, cw);
+
+        // copy annotations
+        for (Annotation annotation : method.getDeclaredAnnotations())
+        {
+            mg.visitAnnotation(Type.getDescriptor(annotation.annotationType()), true).visitEnd();
+        }
+
+        mg.visitCode();
+
+        Label tryBlockStart = exceptionTypes.length > 0 ? mg.mark() : null;
+
+        mg.push(Type.getType(method.getDeclaringClass()));
+
+        // the following code generates the bytecode for this line of Java:
+        // Method method = <proxy>.class.getMethod("add", new Class[] { <array of function argument classes> });
+        // get the method name to invoke, and push to stack
+        mg.push(method.getName());
+
+        // create the Class[]
+        mg.push(methodType.getArgumentTypes().length);
+        mg.newArray(TYPE_CLASS);
+
+        // push parameters into array
+        for (int i = 0; i < methodType.getArgumentTypes().length; i++)
+        {
+            // keep copy of array on stack
+            mg.dup();
+
+            // push index onto stack
+            mg.push(i);
+            mg.push(methodType.getArgumentTypes()[i]);
+            mg.arrayStore(TYPE_CLASS);
+        }
+
+        // invoke getMethod() with the method name and the array of types
+        mg.invokeVirtual(TYPE_CLASS, Method.getMethod("java.lang.reflect.Method getDeclaredMethod(String, Class[])"));
+
+        // the following code generates bytecode equivalent to:
+        // return
+        // ((<returntype>) invoker.invoke(this, method, new Object[] { <function arguments }))[.<primitive>Value()];
+        mg.loadThis();
+
+        mg.getField(proxyType, FIELDNAME_HANDLER, invocationHandlerType);
+        // put below method:
+        mg.swap();
+
+        // we want to pass "this" in as the first parameter
+        mg.loadThis();
+        // put below method:
+        mg.swap();
+
+        // need to construct the array of objects passed in
+        // create the Object[]
+        mg.push(methodType.getArgumentTypes().length);
+        mg.newArray(TYPE_OBJECT);
+
+        // push parameters into array
+        for (int i = 0; i < methodType.getArgumentTypes().length; i++)
+        {
+            // keep copy of array on stack
+            mg.dup();
+
+            // push index onto stack
+            mg.push(i);
+
+            mg.loadArg(i);
+            mg.valueOf(methodType.getArgumentTypes()[i]);
+            mg.arrayStore(TYPE_OBJECT);
+        }
+
+        // invoke the InvocationHandler
+        mg.invokeVirtual(invocationHandlerType,
+                Method.getMethod("Object invoke(Object, java.lang.reflect.Method, Object[])"));
+
+        // cast the result
+        mg.unbox(methodType.getReturnType());
+
+        Label tryBlockEnd = exceptionTypes.length > 0 ? mg.mark() : null;
+
+        // push return
+        mg.returnValue();
+
+        // build try/catch
+        if (exceptionTypes.length > 0)
+        {
+            Label rethrow = mg.mark();
+            mg.visitVarInsn(Opcodes.ASTORE, 1);
+            mg.visitVarInsn(Opcodes.ALOAD, 1);
+            mg.visitInsn(Opcodes.ATHROW);
+
+            // catch declared exceptions and rethrow it...
+            for (Type exceptionType : exceptionTypes)
+            {
+                mg.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrow, exceptionType.getInternalName());
+            }
+
+            // catch Throwable and wrap it with a UndeclaredThrowableException
+            Type uteType = Type.getType(UndeclaredThrowableException.class);
+            rethrow = mg.mark();
+            mg.visitVarInsn(Opcodes.ASTORE, 1);
+            mg.newInstance(uteType);
+            mg.dup();
+            mg.visitVarInsn(Opcodes.ALOAD, 1);
+            mg.invokeConstructor(uteType,
+                    Method.getMethod("void <init>(java.lang.Throwable)"));
+            mg.visitInsn(Opcodes.ATHROW);
+
+            mg.visitTryCatchBlock(tryBlockStart, tryBlockEnd, rethrow, Type.getInternalName(Throwable.class));
+
+            mg.endMethod();
+        }
+
+        // finish the method
+        mg.endMethod();
+        mg.visitMaxs(10, 10);
+        mg.visitEnd();
+    }
+
+
+    private static Type[] getTypes(Class<?>... src)
+    {
+        Type[] result = new Type[src.length];
+        for (int i = 0; i < result.length; i++)
+        {
+            result[i] = Type.getType(src[i]);
+        }
+        return result;
+    }
+
+    /**
+     * Adapted from http://asm.ow2.org/doc/faq.html#Q5
+     *
+     * @param b
+     *
+     * @return Class<?>
+     */
+    private static Class<?> loadClass(ClassLoader loader, String className, byte[] b)
+    {
+        // override classDefine (as it is protected) and define the class.
+        try
+        {
+            java.lang.reflect.Method method = ClassLoader.class.getDeclaredMethod(
+                    "defineClass", String.class, byte[].class, int.class, int.class);
+
+            // protected method invocation
+            boolean accessible = method.isAccessible();
+            if (!accessible)
+            {
+                method.setAccessible(true);
+            }
+            try
+            {
+                return (Class<?>) method.invoke(loader, className, b, Integer.valueOf(0), Integer.valueOf(b.length));
+            }
+            finally
+            {
+                if (!accessible)
+                {
+                    method.setAccessible(false);
+                }
+            }
+        }
+        catch (Exception e)
+        {
+            throw e instanceof RuntimeException ? ((RuntimeException) e) : new RuntimeException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/MethodHandlerProxy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/MethodHandlerProxy.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/MethodHandlerProxy.java
deleted file mode 100644
index c75f85e..0000000
--- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/MethodHandlerProxy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.deltaspike.partialbean.impl;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-//This indirection to create a proxy for javassist.util.proxy.MethodHandler is used as intermediate approach.
-//Further details see comments in PartialBeanLifecycle
-public class MethodHandlerProxy implements InvocationHandler
-{
-    private PartialBeanAbstractMethodHandler partialBeanMethodHandler;
-
-    @Override
-    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-    {
-        //hardcoding the following parameters is ok since MethodHandlerProxy is only used for
-        //javassist.util.proxy.MethodHandler which has one method with those parameters.
-        return partialBeanMethodHandler.invoke(args[0], (Method)args[1], (Method)args[2], (Object[])args[3]);
-    }
-
-    void setPartialBeanMethodHandler(PartialBeanAbstractMethodHandler partialBeanMethodHandler)
-    {
-        this.partialBeanMethodHandler = partialBeanMethodHandler;
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanAbstractMethodHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanAbstractMethodHandler.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanAbstractMethodHandler.java
deleted file mode 100644
index 6b068d5..0000000
--- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanAbstractMethodHandler.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.deltaspike.partialbean.impl;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-
-/**
- * Handler used for partial-beans which are abstract-classes.
- * At runtime it will be called from {@link MethodHandlerProxy} as instance of javassist.util.proxy.MethodHandler
- */
-class PartialBeanAbstractMethodHandler<T extends InvocationHandler>
-{
-    private final T handlerInstance;
-
-    PartialBeanAbstractMethodHandler(T handlerInstance)
-    {
-        this.handlerInstance = handlerInstance;
-    }
-
-    //Signature given by javassist.util.proxy.MethodHandler#invoke
-    public Object invoke(Object target, Method method, Method proceedMethod, Object[] arguments) throws Throwable
-    {
-        if (proceedMethod != null)
-        {
-            return proceedMethod.invoke(target, arguments);
-        }
-        return this.handlerInstance.invoke(target, method, arguments);
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
index 18973a2..19b7b86 100644
--- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanBindingExtension.java
@@ -18,12 +18,13 @@
  */
 package org.apache.deltaspike.partialbean.impl;
 
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.core.util.bean.BeanBuilder;
-import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
-import org.apache.deltaspike.partialbean.api.PartialBeanBinding;
-
+import java.lang.annotation.Annotation;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import javax.enterprise.event.Observes;
 import javax.enterprise.inject.spi.AfterBeanDiscovery;
 import javax.enterprise.inject.spi.AnnotatedType;
@@ -32,28 +33,105 @@ import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.BeforeBeanDiscovery;
 import javax.enterprise.inject.spi.Extension;
 import javax.enterprise.inject.spi.ProcessAnnotatedType;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Modifier;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Logger;
+import org.apache.deltaspike.core.spi.activation.Deactivatable;
+import org.apache.deltaspike.core.util.ClassDeactivationUtils;
+import org.apache.deltaspike.core.util.ServiceUtils;
+import org.apache.deltaspike.core.util.bean.BeanBuilder;
+import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
+import org.apache.deltaspike.partialbean.api.PartialBeanBinding;
+import org.apache.deltaspike.partialbean.spi.PartialBeanDescriptor;
+import org.apache.deltaspike.partialbean.spi.PartialBeanProvider;
 
 public class PartialBeanBindingExtension implements Extension, Deactivatable
 {
-    private static final Logger LOG = Logger.getLogger(PartialBeanBindingExtension.class.getName());
+    private final Map<Class<? extends Annotation>, PartialBeanDescriptor> descriptors =
+            new HashMap<Class<? extends Annotation>, PartialBeanDescriptor>();
+    private final List<Class<?>> alreadyProxied = new ArrayList<Class<?>>();
 
     private Boolean isActivated = true;
-    private Map<Class<?>, Class<? extends Annotation>> partialBeans =
-            new HashMap<Class<?>, Class<? extends Annotation>>();
-    private Map<Class<? extends Annotation>, Class<? extends InvocationHandler>> partialBeanHandlers =
-            new HashMap<Class<? extends Annotation>, Class<? extends InvocationHandler>>();
-
     private IllegalStateException definitionError;
 
     protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery)
     {
         this.isActivated = ClassDeactivationUtils.isActivated(getClass());
+
+        if (!this.isActivated)
+        {
+            return;
+        }
+
+        List<PartialBeanProvider> providers = ServiceUtils.loadServiceImplementations(PartialBeanProvider.class);
+        for (PartialBeanProvider provider : providers)
+        {
+            for (PartialBeanDescriptor descriptor : provider.get())
+            {
+                if (descriptors.containsKey(descriptor.getBinding()))
+                {
+                    PartialBeanDescriptor existingDescriptor = descriptors.get(descriptor.getBinding());
+
+                    // check if multiple handlers are defined for the same binding
+                    if ((descriptor.getHandler() != null
+                            && descriptor.getHandler().equals(existingDescriptor.getHandler()))
+                        || (existingDescriptor.getHandler() != null
+                            && existingDescriptor.getHandler().equals(descriptor.getHandler())))
+                    {
+                        this.definitionError = new IllegalStateException("Multiple handlers found for "
+                                + descriptor.getBinding().getName() + " ("
+                                + descriptor.getHandler().getName() + " and "
+                                + existingDescriptor.getHandler().getName() + ")");
+                        return;
+                    }
+
+                    if (existingDescriptor.getClasses() == null)
+                    {
+                        existingDescriptor.setClasses(new ArrayList<Class<?>>());
+                    }
+
+                    // merge bean classes
+                    if (descriptor.getClasses() != null && descriptor.getClasses().size() > 0)
+                    {
+                        existingDescriptor.getClasses().addAll(descriptor.getClasses());
+                    }
+                }
+                else
+                {
+                    descriptors.put(descriptor.getBinding(), descriptor);
+                }
+            }
+        }
+
+        // loop early partial beans and register them via a new annotated type for the proxy
+        // this enables interceptors on the early provided partial beans
+        for (Map.Entry<Class<? extends Annotation>, PartialBeanDescriptor> entry : this.descriptors.entrySet())
+        {
+            PartialBeanDescriptor descriptor = entry.getValue();
+            if (descriptor.getClasses() != null)
+            {
+                for (Class<?> partialBeanClass : descriptor.getClasses())
+                {
+                    // skip
+                    if (alreadyProxied.contains(partialBeanClass))
+                    {
+                        continue;
+                    }
+
+                    // handler currently not defined - skip early partial bean process
+                    // later if the handler is still null, we will throw a definition error
+                    if (descriptor.getHandler() == null)
+                    {
+                        continue;
+                    }
+
+                    Class<?> partialBeanProxyClass =
+                            PartialBeanProxyFactory.getProxyClass(partialBeanClass, descriptor.getHandler());
+                    AnnotatedType<?> annotatedType =
+                            new AnnotatedTypeBuilder().readFromType(partialBeanProxyClass).create();
+                    beforeBeanDiscovery.addAnnotatedType(annotatedType);
+
+                    alreadyProxied.add(partialBeanClass);
+                }
+            }
+        }
     }
 
     public <X> void findInvocationHandlerBindings(@Observes ProcessAnnotatedType<X> pat, BeanManager beanManager)
@@ -64,28 +142,77 @@ public class PartialBeanBindingExtension implements Extension, Deactivatable
         }
 
         Class<X> beanClass = pat.getAnnotatedType().getJavaClass();
-        Class<? extends Annotation> bindingAnnotationClass = getInvocationHandlerBindingAnnotationClass(pat);
 
-        if (bindingAnnotationClass == null)
+        // skip early generated proxies
+        if (PartialBeanProxyFactory.isProxyClass(beanClass))
+        {
+            return;
+        }
+
+        // skip classes without a partial bean binding
+        Class<? extends Annotation> bindingClass = extractBindingClass(pat);
+        if (bindingClass == null)
         {
             return;
         }
 
-        if ((beanClass.isInterface() || Modifier.isAbstract(beanClass.getModifiers())))
+        if (beanClass.isInterface() || Modifier.isAbstract(beanClass.getModifiers()))
         {
-            this.partialBeans.put(beanClass, bindingAnnotationClass);
+            pat.veto();
+
+            // skip already proxied beans
+            if (alreadyProxied.contains(beanClass))
+            {
+                return;
+            }
+
+            PartialBeanDescriptor descriptor = descriptors.get(bindingClass);
+
+            if (descriptor == null)
+            {
+                descriptor = new PartialBeanDescriptor(bindingClass);
+            }
+
+            if (descriptor.getClasses() == null)
+            {
+                descriptor.setClasses(new ArrayList<Class<?>>());
+            }
+
+            if (!descriptor.getClasses().contains(beanClass))
+            {
+                descriptor.getClasses().add(beanClass);
+                descriptors.put(bindingClass, descriptor);
+            }
         }
         else if (InvocationHandler.class.isAssignableFrom(beanClass))
         {
-            validateInvocationHandler(beanClass, bindingAnnotationClass);
+            PartialBeanDescriptor descriptor = descriptors.get(bindingClass);
 
-            this.partialBeanHandlers.put(bindingAnnotationClass, (Class<? extends InvocationHandler>) beanClass);
+            if (descriptor == null)
+            {
+                descriptor = new PartialBeanDescriptor(bindingClass, (Class<? extends InvocationHandler>) beanClass);
+                descriptors.put(bindingClass, descriptor);
+            }
+            else
+            {
+                if (descriptor.getHandler() == null)
+                {
+                    descriptor.setHandler((Class<? extends InvocationHandler>) beanClass);
+                }
+                else if (!descriptor.getHandler().equals(beanClass))
+                {
+                    this.definitionError = new IllegalStateException("Multiple handlers found for "
+                            + bindingClass.getName() + " ("
+                            + descriptor.getHandler().getName()
+                            + " and " + beanClass.getName() + ")");
+                }
+            }
         }
         else
         {
-            this.definitionError = new IllegalStateException(beanClass.getName() + " is annotated with @" +
-                bindingAnnotationClass.getName() + " and therefore has to be " +
-                "an abstract class, an interface or an implementation of " + InvocationHandler.class.getName());
+            this.definitionError = new IllegalStateException(beanClass.getName() + " is annotated with @"
+                    + bindingClass.getName() + " and therefore has to be "
+                    + "an abstract class, an interface or an implementation of " + InvocationHandler.class.getName());
         }
     }
 
@@ -102,34 +229,43 @@ public class PartialBeanBindingExtension implements Extension, Deactivatable
             return;
         }
 
-        for (Map.Entry<Class<?>, Class<? extends Annotation>> partialBeanEntry : this.partialBeans.entrySet())
+        for (Map.Entry<Class<? extends Annotation>, PartialBeanDescriptor> entry : this.descriptors.entrySet())
         {
-            Bean partialBean = createPartialBean(
-                    partialBeanEntry.getKey(), partialBeanEntry.getValue(), afterBeanDiscovery, beanManager);
-
-            if (partialBean != null)
+            PartialBeanDescriptor descriptor = entry.getValue();
+            if (descriptor.getClasses() != null)
             {
-                afterBeanDiscovery.addBean(partialBean);
+                for (Class partialBeanClass : descriptor.getClasses())
+                {
+                    // skip already/early proxied beans
+                    if (alreadyProxied.contains(partialBeanClass))
+                    {
+                        continue;
+                    }
+
+                    Bean partialBean = createPartialBean(partialBeanClass, descriptor, afterBeanDiscovery, beanManager);
+                    if (partialBean != null)
+                    {
+                        afterBeanDiscovery.addBean(partialBean);
+                        alreadyProxied.add(partialBeanClass);
+                    }
+                }
             }
         }
 
-        this.partialBeans.clear();
-        this.partialBeanHandlers.clear();
+        this.descriptors.clear();
     }
 
-    protected <T> Bean<T> createPartialBean(Class<T> beanClass,
-                                            Class<? extends Annotation> bindingAnnotationClass,
-                                            AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
-    {
-        Class<? extends InvocationHandler> invocationHandlerClass = partialBeanHandlers.get(bindingAnnotationClass);
 
-        if (invocationHandlerClass == null)
+    protected <T> Bean<T> createPartialBean(Class<T> beanClass, PartialBeanDescriptor descriptor,
+            AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
+    {
+        if (descriptor.getHandler() == null)
         {
-            afterBeanDiscovery.addDefinitionError(new IllegalStateException("A class which implements " +
-                    InvocationHandler.class.getName() + " and is annotated with @" +
-                    bindingAnnotationClass.getName() + " is needed as a handler for " +
-                    beanClass.getName() + ". See the documentation about @" +
-                    PartialBeanBinding.class.getName() + "."));
+            afterBeanDiscovery.addDefinitionError(new IllegalStateException("A class which implements "
+                    + InvocationHandler.class.getName()
+                    + " and is annotated with @" + descriptor.getBinding().getName()
+                    + " is needed as a handler for " + beanClass.getName()
+                    + ". See the documentation about @" + PartialBeanBinding.class.getName() + "."));
 
             return null;
         }
@@ -137,12 +273,7 @@ public class PartialBeanBindingExtension implements Extension, Deactivatable
         AnnotatedType<T> annotatedType = new AnnotatedTypeBuilder<T>().readFromType(beanClass).create();
 
         PartialBeanLifecycle beanLifecycle =
-                new PartialBeanLifecycle(beanClass, invocationHandlerClass, afterBeanDiscovery, beanManager);
-
-        if (!beanLifecycle.isValid())
-        {
-            return null;
-        }
+                new PartialBeanLifecycle(beanClass, descriptor.getHandler(), beanManager);
 
         BeanBuilder<T> beanBuilder = new BeanBuilder<T>(beanManager)
                 .readFromType(annotatedType)
@@ -152,7 +283,7 @@ public class PartialBeanBindingExtension implements Extension, Deactivatable
         return beanBuilder.create();
     }
 
-    protected <X> Class<? extends Annotation> getInvocationHandlerBindingAnnotationClass(ProcessAnnotatedType<X> pat)
+    protected <X> Class<? extends Annotation> extractBindingClass(ProcessAnnotatedType<X> pat)
     {
         for (Annotation annotation : pat.getAnnotatedType().getAnnotations())
         {
@@ -164,16 +295,4 @@ public class PartialBeanBindingExtension implements Extension, Deactivatable
 
         return null;
     }
-
-    protected <X> void validateInvocationHandler(Class<X> beanClass,
-                                                 Class<? extends Annotation> bindingAnnotationClass)
-    {
-        Class<? extends InvocationHandler> alreadyFoundHandler = this.partialBeanHandlers.get(bindingAnnotationClass);
-        if (alreadyFoundHandler != null)
-        {
-            this.definitionError = new IllegalStateException("Multiple handlers found for " +
-                    bindingAnnotationClass.getName() + " (" +
-                    alreadyFoundHandler.getName() + " and " + beanClass.getName() + ")");
-        }
-    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
index d6a5891..3429081 100644
--- a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanLifecycle.java
@@ -18,108 +18,56 @@
  */
 package org.apache.deltaspike.partialbean.impl;
 
-import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.util.ClassUtils;
 import org.apache.deltaspike.core.util.ExceptionUtils;
-import org.apache.deltaspike.core.util.metadata.builder.AnnotatedTypeBuilder;
 import org.apache.deltaspike.core.util.metadata.builder.ContextualLifecycle;
 
-import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.AfterBeanDiscovery;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.InjectionTarget;
 import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
 import java.util.Set;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.inject.spi.AnnotatedType;
+import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
+import org.apache.deltaspike.core.api.provider.BeanProvider;
 
-//The usage of reflection and the indirection for MethodHandler is needed to avoid the hard dependency to javassist.
-//Some users don't like to have it as a required dependency,
-// but they would like to use interfaces for partial beans and don't need abstract classes as partial beans.
-
-//We use these indirections as >intermediate< approach. That way no classpath-scanner can cause issues.
 class PartialBeanLifecycle<T, H extends InvocationHandler> implements ContextualLifecycle<T>
 {
-    private final Class<? extends T> partialBeanProxyClass;
-
-    private final InjectionTarget<T> partialBeanInjectionTarget;
+    private final Class<T> proxyClass;
+    private final Class<T> partialBeanClass;
     private final Class<H> handlerClass;
+    
+    private InjectionTarget<T> injectionTarget;
     private CreationalContext<?> creationalContextOfDependentHandler;
-    private final boolean isInterfaceMode;
-    private final boolean valid;
-
 
-    PartialBeanLifecycle(Class<T> partialBeanClass, Class<H> handlerClass,
-                         AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
+    PartialBeanLifecycle(Class<T> partialBeanClass, Class<H> handlerClass, BeanManager beanManager)
     {
+        this.partialBeanClass = partialBeanClass;
+        this.proxyClass = PartialBeanProxyFactory.getProxyClass(partialBeanClass, handlerClass);
         this.handlerClass = handlerClass;
 
-        if (partialBeanClass.isInterface())
-        {
-            this.isInterfaceMode = true;
-            this.partialBeanInjectionTarget = null;
-            this.partialBeanProxyClass = partialBeanClass;
-        }
-        else
+        if (!partialBeanClass.isInterface())
         {
-            this.isInterfaceMode = false;
-            AnnotatedTypeBuilder<T> partialBeanTypeBuilder =
-                new AnnotatedTypeBuilder<T>().readFromType(partialBeanClass);
-            this.partialBeanInjectionTarget = beanManager.createInjectionTarget(partialBeanTypeBuilder.create());
-
-            try
-            {
-                Object proxyFactory = ClassUtils.tryToInstantiateClassForName("javassist.util.proxy.ProxyFactory");
-
-                if (proxyFactory == null)
-                {
-                    afterBeanDiscovery.addDefinitionError(new IllegalStateException(
-                        "For using abstract classes as partial beans," +
-                                "it's needed to add the lib 'javassist' to the classpath."));
-                    partialBeanProxyClass = null;
-                    this.valid = false;
-                    return;
-                }
-                Method setSuperclassMethod = proxyFactory.getClass().getDeclaredMethod("setSuperclass", Class.class);
-                setSuperclassMethod.invoke(proxyFactory, partialBeanClass);
-
-                Method createClassMethod = proxyFactory.getClass().getDeclaredMethod("createClass");
-
-                this.partialBeanProxyClass =
-                        ((Class<?>) createClassMethod.invoke(proxyFactory)).asSubclass(partialBeanClass);
-            }
-            catch (Exception e)
-            {
-                throw ExceptionUtils.throwAsRuntimeException(e);
-            }
+            AnnotatedType<T> annotatedType = beanManager.createAnnotatedType(this.partialBeanClass);
+            this.injectionTarget = beanManager.createInjectionTarget(annotatedType);
         }
-
-        /*TODO re-visit the need of MethodFilter - we would need an indirection for it as with MethodHandler
-        proxyFactory.setFilter(new MethodFilter()
-        {
-            public boolean isHandled(Method method)
-            {
-                return !"finalize".equals(method.getName());
-            }
-        });
-         */
-        this.valid = true;
     }
 
+    @Override
     public T create(Bean bean, CreationalContext creationalContext)
     {
         try
         {
-            H handlerInstance = createHandlerInstance();
-            T instance = createPartialBeanProxyInstance(handlerInstance);
+            T instance = proxyClass.newInstance();
+
+            // only required here, for early partial beans, the handler will be injected and handled by CDI
+            ((PartialBeanProxy) instance).setHandler(createHandlerInstance());
 
-            if (this.partialBeanInjectionTarget != null)
+            if (this.injectionTarget != null)
             {
-                this.partialBeanInjectionTarget.inject(instance, creationalContext);
-                this.partialBeanInjectionTarget.postConstruct(instance);
+                this.injectionTarget.inject(instance, creationalContext);
+                this.injectionTarget.postConstruct(instance);
             }
 
             return instance;
@@ -128,85 +76,49 @@ class PartialBeanLifecycle<T, H extends InvocationHandler> implements Contextual
         {
             ExceptionUtils.throwAsRuntimeException(e);
         }
+
         //can't happen
         return null;
     }
 
-    private T createPartialBeanProxyInstance(H handlerInstance) throws Exception
+    @Override
+    public void destroy(Bean<T> bean, T instance, CreationalContext<T> creationalContext)
     {
-        T instance;
-
-        if (this.isInterfaceMode)
+        if (this.injectionTarget != null)
         {
-            instance = (T) Proxy.newProxyInstance(
-                    ClassUtils.getClassLoader(this), new Class[]{this.partialBeanProxyClass}, handlerInstance);
+            this.injectionTarget.preDestroy(instance);
         }
-        else //partial-bean is an interface
+        
+        if (this.creationalContextOfDependentHandler != null)
         {
-            instance = this.partialBeanProxyClass.newInstance();
-
-            Class methodHandlerClass = ClassUtils.tryToLoadClassForName("javassist.util.proxy.MethodHandler");
-            Method setHandlerMethod = ClassUtils.tryToLoadClassForName("javassist.util.proxy.ProxyObject")
-                    .getDeclaredMethod("setHandler", methodHandlerClass);
-
-
-            MethodHandlerProxy methodHandlerProxy = new MethodHandlerProxy();
-            methodHandlerProxy.setPartialBeanMethodHandler(new PartialBeanAbstractMethodHandler<H>(handlerInstance));
-
-            Object methodHandler = Proxy.newProxyInstance(
-                    ClassUtils.getClassLoader(this), new Class[]{methodHandlerClass}, methodHandlerProxy);
-
-            setHandlerMethod.invoke(instance, methodHandler);
+            this.creationalContextOfDependentHandler.release();
         }
-        return instance;
-    }
 
+        creationalContext.release();
+    }
+    
     private H createHandlerInstance()
     {
         Set<Bean<H>> handlerBeans = BeanProvider.getBeanDefinitions(this.handlerClass, false, true);
-
+        
         if (handlerBeans.size() != 1)
         {
             throw new IllegalStateException(handlerBeans.size() + " beans found for " + this.handlerClass);
         }
 
         Bean<H> handlerBean = handlerBeans.iterator().next();
-
+        
         BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
-        CreationalContext<?> creationalContextOfHandler = beanManager.createCreationalContext(handlerBean);
-
-        H handlerInstance = (H)beanManager.getReference(handlerBean, this.handlerClass, creationalContextOfHandler);
+        CreationalContext<?> creationalContext = beanManager.createCreationalContext(handlerBean);
+        
+        H handlerInstance = (H) beanManager.getReference(handlerBean, this.handlerClass, creationalContext);
 
         if (handlerBean.getScope().equals(Dependent.class))
         {
-            this.creationalContextOfDependentHandler = creationalContextOfHandler;
-        }
-        return handlerInstance;
-    }
-
-    public void destroy(Bean<T> bean, T instance, CreationalContext<T> creationalContext)
-    {
-        if (this.partialBeanInjectionTarget != null)
-        {
-            this.partialBeanInjectionTarget.preDestroy(instance);
-        }
-
-        if (this.creationalContextOfDependentHandler != null)
-        {
-            this.creationalContextOfDependentHandler.release();
+            this.creationalContextOfDependentHandler = creationalContext;
         }
 
-        /*
-        H handlerInstance = (H) ((PartialBeanAbstractMethodHandler)((ProxyObject) instance)
-          .getHandler()).getHandlerInstance();
-        injectionTarget.dispose(handlerInstance); //currently producers aren't supported
-        }
-        */
-        creationalContext.release();
-    }
-
-    boolean isValid()
-    {
-        return valid;
+        return handlerInstance;
     }
 }
+

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxy.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxy.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxy.java
new file mode 100644
index 0000000..e7ddbf2
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxy.java
@@ -0,0 +1,28 @@
+/*
+ * 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.deltaspike.partialbean.impl;
+
+import java.lang.reflect.InvocationHandler;
+
+public interface PartialBeanProxy
+{
+    void setHandler(InvocationHandler handler);
+    
+    InvocationHandler getHandler();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
new file mode 100644
index 0000000..34d6a2c
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/main/java/org/apache/deltaspike/partialbean/impl/PartialBeanProxyFactory.java
@@ -0,0 +1,178 @@
+/*
+ * 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.deltaspike.partialbean.impl;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import javax.enterprise.inject.Typed;
+import org.apache.deltaspike.core.util.ClassUtils;
+
+@Typed
+public abstract class PartialBeanProxyFactory
+{
+    private static final String CLASSNAME_SUFFIX = "$$DSPartialBeanProxy";
+
+    private PartialBeanProxyFactory()
+    {
+        // prevent instantiation
+    }
+
+    public static <T> Class<T> getProxyClass(Class<T> targetClass,
+            Class<? extends InvocationHandler> invocationHandlerClass)
+    {
+        Class<T> proxyClass = ClassUtils.tryToLoadClassForName(constructProxyClassName(targetClass), targetClass);
+        if (proxyClass == null)
+        {
+            proxyClass = createProxyClass(targetClass.getClassLoader(), targetClass, invocationHandlerClass);
+        }
+
+        return proxyClass;
+    }
+
+    private static synchronized <T> Class<T> createProxyClass(ClassLoader classLoader, Class<T> targetClass,
+            Class<? extends InvocationHandler> invocationHandlerClass)
+    {
+        Class<T> proxyClass = ClassUtils.tryToLoadClassForName(constructProxyClassName(targetClass), targetClass);
+        if (proxyClass == null)
+        {
+            proxyClass = ASMProxyClassGenerator.generateProxyClass(classLoader,
+                    targetClass,
+                    invocationHandlerClass,
+                    CLASSNAME_SUFFIX,
+                    findNotImplementedMethods(targetClass));
+        }
+
+        return proxyClass;
+    }
+
+    private static String constructProxyClassName(Class<?> clazz)
+    {
+        return clazz.getCanonicalName() + CLASSNAME_SUFFIX;
+    }
+
+    /**
+     * Checks if the given class is partial bean proxy class.
+     *
+     * @param clazz
+     * @return
+     */
+    public static boolean isProxyClass(Class<?> clazz)
+    {
+        return clazz.getName().endsWith(CLASSNAME_SUFFIX);
+    }
+
+    /**
+     * Collects all abstract methods which needs to be proxied from the given class and super classes...
+     *
+     * @param clazz The clazz which will be proxied.
+     * @return All abstract methods.
+     */
+    private static Method[] findNotImplementedMethods(Class<?> clazz)
+    {
+        List<Method> methods = new ArrayList<Method>(Arrays.asList(clazz.getMethods()));
+        for (Method method : clazz.getDeclaredMethods())
+        {
+            if (!methods.contains(method))
+            {
+                methods.add(method);
+            }
+        }
+
+        // collect methods from abstract super classes...
+        Class currentSuperClass = clazz.getSuperclass();
+        while (currentSuperClass != null)
+        {
+            if (Modifier.isAbstract(currentSuperClass.getModifiers()))
+            {
+                for (Method method : currentSuperClass.getMethods())
+                {
+                    if (!methods.contains(method))
+                    {
+                        methods.add(method);
+                    }
+                }
+                for (Method method : currentSuperClass.getDeclaredMethods())
+                {
+                    if (!methods.contains(method))
+                    {
+                        methods.add(method);
+                    }
+                }
+            }
+            currentSuperClass = currentSuperClass.getSuperclass();
+        }
+
+        // sort out invalid methods
+        Iterator<Method> it = methods.iterator();
+        while (it.hasNext())
+        {
+            Method method = it.next();
+
+            if (method.isBridge())
+            {
+                // we have no interest in generics bridge methods
+                it.remove();
+            }
+
+            if (!Modifier.isAbstract(method.getModifiers()))
+            {
+                it.remove();
+            }
+            
+            if ("finalize".equals(method.getName()))
+            {
+                // we do not proxy finalize()
+                it.remove();
+            }
+        }
+
+        // sort out somewhere implemented abstract methods
+        Class currentClass = clazz;
+        while (currentClass != null)
+        {
+            Iterator<Method> methodIterator = methods.iterator();
+            while (methodIterator.hasNext())
+            {
+                Method method = methodIterator.next();
+                try
+                {
+                    Method foundMethod = currentClass.getMethod(method.getName(), method.getParameterTypes());
+                    // if method is implementent in the current class -> remove it
+                    if (foundMethod != null && !Modifier.isAbstract(foundMethod.getModifiers()))
+                    {
+                        methodIterator.remove();
+                    }
+                }
+                catch (Exception e)
+                {
+                    // ignore...
+                }
+            }
+
+            currentClass = currentClass.getSuperclass();
+        }
+
+        return methods.toArray(new Method[methods.size()]);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanBinding.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanBinding.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanBinding.java
new file mode 100644
index 0000000..be7294b
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanBinding.java
@@ -0,0 +1,35 @@
+/*
+ * 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.deltaspike.test.core.api.partialbean.shared;
+
+import org.apache.deltaspike.partialbean.api.PartialBeanBinding;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+@PartialBeanBinding
+
+@Retention(RUNTIME)
+@Target(TYPE)
+public @interface ThrowExceptionPartialBeanBinding
+{
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanHandler.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanHandler.java
new file mode 100644
index 0000000..e9aff22
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/shared/ThrowExceptionPartialBeanHandler.java
@@ -0,0 +1,34 @@
+/*
+ * 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.deltaspike.test.core.api.partialbean.shared;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import javax.enterprise.context.ApplicationScoped;
+
+@ThrowExceptionPartialBeanBinding
+@ApplicationScoped
+public class ThrowExceptionPartialBeanHandler implements InvocationHandler
+{
+    @Override
+    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+    {
+        throw new ClassNotFoundException();
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
index e8415de..5fa167f 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc002/PartialBeanAsAbstractClassTest.java
@@ -20,7 +20,6 @@ package org.apache.deltaspike.test.core.api.partialbean.uc002;
 
 import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
 import org.apache.deltaspike.test.core.api.partialbean.util.ArchiveUtils;
-import org.apache.deltaspike.test.utils.CdiContainerUnderTest;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -55,16 +54,6 @@ public class PartialBeanAsAbstractClassTest
                 .addAsLibraries(testJar)
                 .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
 
-        if (CdiContainerUnderTest.is("owb-.*")   ||
-            CdiContainerUnderTest.is("tomee-.*") ||
-            CdiContainerUnderTest.is("wildfly-.*") ||
-            CdiContainerUnderTest.is("glassfish-.*"))
-        {
-            JavaArchive javassistJar = ShrinkWrap.create(JavaArchive.class, "dsjavassist.jar")
-                    .addPackages(true, "javassist");
-            webArchive.addAsLibrary(javassistJar);
-        }
-
         return webArchive;
     }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/AbstractSuper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/AbstractSuper.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/AbstractSuper.java
new file mode 100644
index 0000000..7136b5e
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/AbstractSuper.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.core.api.partialbean.uc004;
+
+public abstract class AbstractSuper implements SuperInterface
+{
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ApplicationScopedPartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ApplicationScopedPartialBean.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ApplicationScopedPartialBean.java
index 8400e23..13474fc 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ApplicationScopedPartialBean.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ApplicationScopedPartialBean.java
@@ -24,7 +24,7 @@ import javax.enterprise.context.ApplicationScoped;
 
 @TestPartialBeanBinding
 @ApplicationScoped
-public abstract class ApplicationScopedPartialBean
+public abstract class ApplicationScopedPartialBean extends AbstractSuper
 {
     private int count;
 
@@ -34,4 +34,4 @@ public abstract class ApplicationScopedPartialBean
     {
         return count++;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ScopedPartialBeanTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ScopedPartialBeanTest.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ScopedPartialBeanTest.java
index 7045b71..2be3ed6 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ScopedPartialBeanTest.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/ScopedPartialBeanTest.java
@@ -51,16 +51,6 @@ public class ScopedPartialBeanTest
                 .addAsLibraries(testJar)
                 .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
 
-        if (CdiContainerUnderTest.is("owb-.*")   ||
-            CdiContainerUnderTest.is("tomee-.*") ||
-            CdiContainerUnderTest.is("wildfly-.*") ||
-            CdiContainerUnderTest.is("glassfish-.*"))
-        {
-            JavaArchive javassistJar = ShrinkWrap.create(JavaArchive.class, "dsjavassist.jar")
-                    .addPackages(true, "javassist");
-            webArchive.addAsLibrary(javassistJar);
-        }
-
         return webArchive;
     }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/SuperInterface.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/SuperInterface.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/SuperInterface.java
new file mode 100644
index 0000000..be2acf0
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc004/SuperInterface.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.core.api.partialbean.uc004;
+
+public interface SuperInterface
+{
+    String willFail();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/AbstractSuper.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/AbstractSuper.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/AbstractSuper.java
new file mode 100644
index 0000000..e7dd2b9
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/AbstractSuper.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.core.api.partialbean.uc005;
+
+public abstract class AbstractSuper
+{
+    abstract String willFail2();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e58890b5/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ApplicationScopedPartialBean.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ApplicationScopedPartialBean.java b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ApplicationScopedPartialBean.java
new file mode 100644
index 0000000..af64475
--- /dev/null
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc005/ApplicationScopedPartialBean.java
@@ -0,0 +1,37 @@
+/*
+ * 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.deltaspike.test.core.api.partialbean.uc005;
+
+import javax.enterprise.context.ApplicationScoped;
+
+import org.apache.deltaspike.test.core.api.partialbean.shared.TestPartialBeanBinding;
+
+@TestPartialBeanBinding
+@ApplicationScoped
+public abstract class ApplicationScopedPartialBean extends AbstractSuper implements SuperInterface
+{
+    private int count;
+
+    public abstract String getResult();
+
+    public int getManualResult()
+    {
+        return count++;
+    }
+}


Mime
View raw message