maybe the service "ObjectLocator" will help you too - it creates objects and injects services into them, event if they are not services that are known to the registry via its "autobuild" method.

xfile80303 schrieb:
Thanks Thiago,

Your insight, as always, is appreciated.

Unfortunately there seems to be a snag...

In my page I have this:

        @SessionState
        private User ssUser;

In my Module I have this:

        public static void bind(ServiceBinder binder)
        {
                //...
                binder.bind(User.class, UserImpl.class);
                //...
        }

(I've commented out the contribution of the new service scope for now)

and I get this:

org.apache.tapestry5.runtime.ComponentEventException
Class com.java.dse.cwp.eos.idm.User does not contain a public constructor
needed to autobuild.

It's as if Tapestry does not recognize the binding.  Other bindings I have
work as expected... is there something special about SessionState objects?

BTW, User and UserImpl are in my services package, with my other, working,
bound services.

Thanks,

Levi


Thiago H. de Paula Figueiredo wrote:
Hi!

I guess you need a new service scope. Tapestry-IoC provides two out-of-the-box: singleton (default) and per-thread (one object created for each different thread). You can add a new lifecycle that always returns a new object. In Spring, this is called the prototype scope. http://tapestry.apache.org/tapestry5.1/apidocs/org/apache/tapestry5/ioc/annotations/Scope.html will give you some hints about how to add new scopes.

A less elegant solution is to inject ObjectLocator and use its autobuild() method.

--
Thiago H. de Paula Figueiredo
Independent Java consultant, developer, and instructor
http://www.arsmachina.com.br/thiago

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





--
Felix Gonschorek
ggmedia

Kirchstr. 18
69115 Heidelberg

Tel:   +49 6221 187 44 10
Fax:   +49 6221 187 44 99
Mobil: +49 176 2234 1338

fe...@ggmedia.net
http://www.ggmedia.net

Vertretungsberechtigte Gesellschafter:
Felix Gonschorek & Jochen Greiner

Umsatzsteuer-Identifikationsnummer
gemäß § 27a Umsatzsteuergesetz:
DE232906440

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

Reply via email to