|
From: Dain S. <da...@iq...> - 2005-05-30 02:04:05
|
Hi all,
I've been working on an implementation of the Geronimo kernel
interface using Spring. All is going well, but I have run into one
feature Geronimo has that Spring doesn't. In Geronimo a bean can
have dynamic properties. A dynamic property is treated just like any
other property but instead of calling setFoo(value), we call
setAttribute("foo", value). These are set when the other setter
injected properties are set.
Have you guys ever considered adding support for dynamic attributes?
An alternative solution is to allow generic method invocation before
init method is called.
-dain
|
|
From: Alexandru P. <apo...@ez...> - 2005-05-30 06:22:33
|
#: on behalf of Dain Sundstrom :: 5/30/2005 4:03 AM :#
> Hi all,
>
> I've been working on an implementation of the Geronimo kernel
> interface using Spring. All is going well, but I have run into one
> feature Geronimo has that Spring doesn't. In Geronimo a bean can
> have dynamic properties. A dynamic property is treated just like any
> other property but instead of calling setFoo(value), we call
> setAttribute("foo", value). These are set when the other setter
> injected properties are set.
>
> Have you guys ever considered adding support for dynamic attributes?
>
> An alternative solution is to allow generic method invocation before
> init method is called.
>
> -dain
>
>
Hi Dain!
If you search the forum you will find different solutions to the above problem. I was looking for
the same thing for a while, and currently i am quite happy with a modified solution I've found on forum.
For the 2nd question: do you need another method call than the after-init?
:alex |.::the_mindstorm::.|
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|
|
From: Dain S. <da...@iq...> - 2005-05-30 15:54:17
|
On May 30, 2005, at 12:19 AM, Alexandru Popescu wrote:
> If you search the forum you will find different solutions to the
> above problem. I was looking for
> the same thing for a while, and currently i am quite happy with a
> modified solution I've found on forum.
Can you give me a hint on what to search for? I could spend hours
looking for this.
> For the 2nd question: do you need another method call than the
> after-init?
I'm not sure what you mean. In geronimo the normal geronimo bean
creation process is:
1) call constructor
Foo foo = new Foo(a, b, c)
2) setter inject including dynamic properties (order is not important)
foo.setBar(bar)
foo.setAtttibute("baz", baz);
foo.setCheese(cheese);
foo.setAtttibute("donkey", donkey);
3) call initialization done method
foo.doStart();
So all injection must occur before the initialization method. I can
think of two ways to support dynamic properties directly in spring:
1) specifically support them by a dynamicSetterName field to the bean
definition, and either automatically assume that any property without
a setter is a dynamic property, or have some way for a user to flag a
property as dynamic
2) generically support additional initialization methods (with
arguments) before the final after-init method is called. This would
require adding a list of method names with args to invoke. For the
args, you could just the same matching rules as constructor injection.
The first option is simpler and cleaner, but the second is much more
powerful (more complex and a bit ugly).
-dain
|
|
From: Alexandru P. <apo...@ez...> - 2005-05-30 16:28:11
|
#: on behalf of Dain Sundstrom :: 5/30/2005 5:54 PM :#
> On May 30, 2005, at 12:19 AM, Alexandru Popescu wrote:
>
>> If you search the forum you will find different solutions to the
>> above problem. I was looking for
>> the same thing for a while, and currently i am quite happy with a
>> modified solution I've found on forum.
>
> Can you give me a hint on what to search for? I could spend hours
> looking for this.
>
1/ Run-time Dependency Injection
2/ Prototype bean constructor/factory runtime args
3/ JIRA issues SPR-334 and SPR-695
pls let me know if these are what you are looking for.
>> For the 2nd question: do you need another method call than the
>> after-init?
>
> I'm not sure what you mean. In geronimo the normal geronimo bean
> creation process is:
>
> 1) call constructor
> Foo foo = new Foo(a, b, c)
>
> 2) setter inject including dynamic properties (order is not important)
> foo.setBar(bar)
> foo.setAtttibute("baz", baz);
> foo.setCheese(cheese);
> foo.setAtttibute("donkey", donkey);
>
> 3) call initialization done method
> foo.doStart();
>
>
> So all injection must occur before the initialization method. I can
> think of two ways to support dynamic properties directly in spring:
>
> 1) specifically support them by a dynamicSetterName field to the bean
> definition, and either automatically assume that any property without
> a setter is a dynamic property, or have some way for a user to flag a
> property as dynamic
>
> 2) generically support additional initialization methods (with
> arguments) before the final after-init method is called. This would
> require adding a list of method names with args to invoke. For the
> args, you could just the same matching rules as constructor injection.
>
> The first option is simpler and cleaner, but the second is much more
> powerful (more complex and a bit ugly).
>
> -dain
>
>
I see. Take a look at the possible solutions and if those are not good enough maybe somebody else
will be able to provide another way to do it.
cheers,
:alex |.::the_mindstorm::.|
> -------------------------------------------------------
> This SF.Net email is sponsored by Yahoo.
> Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
> Search APIs Find out how you can build Yahoo! directly into your own
> Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
> _______________________________________________
> Springframework-developer mailing list
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
>
|