On Jun 28, 2008, at 10:28 AM, Jacek Laskowski wrote:

On Sat, Jun 28, 2008 at 4:39 AM,  <[EMAIL PROTECTED]> wrote:
Author: dblevins
Date: Fri Jun 27 19:39:54 2008
New Revision: 672458

URL: http://svn.apache.org/viewvc?rev=672458&view=rev
Log:
OPENEJB-126: Constructor Injection
Works for stateless and stateful beans
Switched to xbean libraries version 3.4.1
...
private static void fillInjectionProperties(ObjectRecipe objectRecipe, Class clazz, CoreDeploymentInfo deploymentInfo, Context context) {
+        boolean usePrefix = true;
+
+        try {
+            clazz.getConstructor();
+        } catch (NoSuchMethodException e) {
+            // Using constructor injection
+            // xbean can't handle the prefix yet
+            usePrefix = false;
+        }
+

What's the prefix? What doesn't XBean support?

XBean supports property names in the form of "class/property" so that if there's the same property in a super class and in a subclass, both can be injected with separate values. The "find a constructor" code doesn't support that yet, so if you don't have a no-arg constructor we have to shave off the class prefix so it can find the constructor.

Important note as well. Constructors only work if you compile your code with debug. We're using the debug table in the byte code to get the constructor parameter names.

-David

Reply via email to