Something like "DecorateTransactionally" that could be used to tell Tapestry IOC which classes are using injected fields, and do the injection/instrumentation on them.
On Wed, Apr 29, 2009 at 12:10 PM, daniel joyce <[email protected]> wrote: > So basically once I start using Injection, every class that uses a > injected class needs to be injected itself. > > It would be nice if this could be improved upon, thus allowing > 'services' and non-page, non-service business objects to play nicely > together. > > -Daniel > > On Wed, Apr 29, 2009 at 11:39 AM, Howard Lewis Ship <[email protected]> wrote: >> There isn't a mechanism for doing this via new C(). Tapestry IoC is >> less intrusive than tapestry-core, it doesn't instrument your code the >> way the web framework does, but it will use reflection to inject into >> private fields. >> >> @Autobuild always creates a new instance. >> >> >> On Wed, Apr 29, 2009 at 11:27 AM, daniel joyce <[email protected]> >> wrote: >>> I have a class C, that is not a service, nor a page/component >>> >>> I want to Inject a resource into it >>> >>> @Inject >>> SomeService service >>> >>> When I use "new C()", I want them to be seperate instances, not >>> singletons, or per-thread singletons, with that service wired in. >>> >>> Will what you posted do this? >>> >>> Because when I hear "Autobuild", my understanding is it generates >>> singletons. But there is no guarantee this class C which is using >>> SomeService is itself written to be a threadsafe singleton. >>> >>> >>> On Wed, Apr 29, 2009 at 11:19 AM, Howard Lewis Ship <[email protected]> >>> wrote: >>>> In the following scenario: >>>> >>>> public void contributeMyConfiguration(Configuration<Foo> >>>> configuration, @Autobuild FooImpl foo) >>>> { >>>> configuration.add(foo); >>>> } >>>> >>>> Tapestry will autobuild foo using the same rules as services. Another >>>> approach: >>>> >>>> public void contributeMyConfiguration(Configuration<Foo> configuration) >>>> { >>>> configuration.addInstance(FooImpl.class); >>>> } >>>> >>>> This is an alternate way to inject an autobuild instance of the class. >>>> >>>> >>>> On Wed, Apr 29, 2009 at 10:56 AM, daniel joyce <[email protected]> >>>> wrote: >>>>> Is there any way to have a non-component class work with injection, >>>>> w/o having to turn it into a service itself? >>>>> >>>>> @Inject >>>>> private SystemProperties sysProps; >>>>> >>>>> I have a class that simply zips up files, and it needs access to a >>>>> system properties service. IIRC, but when I tried this in the past, it >>>>> didn't work for classes that were not pages/components. I also don't >>>>> want to necessarily turn a class into a service merely to give it >>>>> access to another service. >>>>> >>>>> Any way to do this? Or was I simply doing it wrong before? >>>>> >>>>> -Daniel >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>>> >>>> >>>> >>>> >>>> -- >>>> Howard M. Lewis Ship >>>> >>>> Creator of Apache Tapestry >>>> Director of Open Source Technology at Formos >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: [email protected] >>> For additional commands, e-mail: [email protected] >>> >>> >> >> >> >> -- >> Howard M. Lewis Ship >> >> Creator of Apache Tapestry >> Director of Open Source Technology at Formos >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
