Hi Jason,
You could have a look at http://code.google.com/p/salve/
By making use of some byte code instrumentation it will replace your
dependency injections by static lookups, i.e. the best of both worlds. I
wouldn't know about the performance of each approach however.
Regards,
Wilko
Jason Wang-2 wrote:
>
> Hi all,
>
> Although I am using spring-wicket to prevent the whole spring being
> serialized, It still brothers me to see the references in the model
> object, for example:
>
> Instead of using this:
>
> public class MyViewObjectProvider extends SortableDataProvider{
>
> @SpringBean("daoService")
> private DAOServices daoService;
>
> private String objectID;
>
> public Iterator iterator(final int first, final int count){
> .....
> return daoService.load(objectId).subList(first,
> first+count).iterator();
> }
>
> }
>
>
>
> I always write a singleton helper class for the service to be used, so I
> can have the model this way:
>
> public class MyViewObjectProvider extends SortableDataProvider{
>
> //so no reference to the dao service object
>
> private String objectID;
>
> public Iterator iterator(final int first, final int count){
> .....
> //here the DAOServiceHelper.get() returns a instance that managed by
> spring(with the actual service object injected.)
> return DAOServiceHelper.get().load(objectId).subList(first,
> first+count).iterator();
> }
>
>
> }
>
> So my question is, will there be a noticeable performance gain to do it
> the 2nd way?
> The reason to ask is that the static kind of singleton usage is indeed
> anti-spring, and makes
> my eyes bleed....
>
> If no one has done a performance comparison, I might have to do one
> myself. Just being lazzzzzy...
>
>
> Thanks,
>
> Jason Wang
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>
--
View this message in context:
http://www.nabble.com/will-there-be-a-performance-gain-to-use-singleton-to-remove-references-to-the-service-object-in-models--tp24690276p24694064.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]