You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Britske <gb...@gmail.com> on 2007/10/23 11:27:56 UTC

T5: how to let pojo (no component) have reference to PropertyAccess

I have a helperclass SelectModelRepository which centralizes logic concerning
selectmodels which different pages/ components can access. This class needs
a reference to PropertyAccess to do some of its work, which normally is
available as: 

@Inject PropertyAccess _access.

However, this only works on components and not ordinary pojo's like the one
described above (i know... components are pojo's too ;-)

I tried passing the PropertyAccess-instance from a component to the
SelectModelRepository, but that didn't work because the
PropertyAccess-instance is only seen as a proxy since the JustInTimeCreator
proxies the class until it is needed. This all results in
NullPointer-exceptions when referencing the PropertyAccess-instance form the
SelectModelRepository. 

Is there any way to get a valid reference to the PropertyAccess-instance
from my 
SelectModelRepository-instance? 

The SelectModelRepository-instance is a singleton, so of course it could be
injected through Tapestry-ioc, although i havn't tried  tapestry-ioc yet at
all though. The trouble is that now it is configured as a Spring-IOC
instance with a whole chain of spring-ioc-references to build it. So
transferring it to Tapestry-ioc gets a bit messy i guess. If no other
solution exists, could you show a simple example of where (what file) and
how to configure the SelectModelRepository-instance as Tapestry-ioc service, 

thanks,
Geert-Jan
-- 
View this message in context: http://www.nabble.com/T5%3A-how-to-let-pojo-%28no-component%29-have-reference-to-PropertyAccess-tf4676141.html#a13360247
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5: how to let pojo (no component) have reference to PropertyAccess

Posted by Britske <gb...@gmail.com>.
Never mind.
I thought it would be difficult to define SelectModelRepository in
Tapestry-IOC given the existing spring-ioc chain it needs for construction.
I didn't realize injecting spring-instances in the build()-method of
Tapestry-IOC works just as good as normally in components.. and i love it
;-)



Britske wrote:
> 
> I have a helperclass SelectModelRepository which centralizes logic
> concerning selectmodels which different pages/ components can access. This
> class needs a reference to PropertyAccess to do some of its work, which
> normally is available as: 
> 
> @Inject PropertyAccess _access.
> 
> However, this only works on components and not ordinary pojo's like the
> one described above (i know... components are pojo's too ;-)
> 
> I tried passing the PropertyAccess-instance from a component to the
> SelectModelRepository, but that didn't work because the
> PropertyAccess-instance is only seen as a proxy since the
> JustInTimeCreator proxies the class until it is needed. This all results
> in NullPointer-exceptions when referencing the PropertyAccess-instance
> form the SelectModelRepository. 
> 
> Is there any way to get a valid reference to the PropertyAccess-instance
> from my 
> SelectModelRepository-instance? 
> 
> The SelectModelRepository-instance is a singleton, so of course it could
> be injected through Tapestry-ioc, although i havn't tried  tapestry-ioc
> yet at all though. The trouble is that now it is configured as a
> Spring-IOC instance with a whole chain of spring-ioc-references to build
> it. So transferring it to Tapestry-ioc gets a bit messy i guess. If no
> other solution exists, could you show a simple example of where (what
> file) and how to configure the SelectModelRepository-instance as
> Tapestry-ioc service, 
> 
> thanks,
> Geert-Jan
> 

-- 
View this message in context: http://www.nabble.com/T5%3A-how-to-let-pojo-%28no-component%29-have-reference-to-PropertyAccess-tf4676141.html#a13360773
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org