@EagerLoad support predates @Startup support, so it's probably just a
case of adding new logic at the bottom of a method somewhere.

Even though the relationship is not documented, it is also not likely
to change, in case some other group of developers have written code in
expectation of the current order.

BTW, it's not a problem if an @EagerLoad-ed service injects and
invokes methods on some other service; the other service will simply
be created as needed.  Thus you can use @EagerLoad pretty sparingly.

The intention of @EagerLoad as to support services whose lifecycle was
driven by factors outside of the IoC container: i.e., the service
implementation listens on a port (like a web server), or recieves
messages via JMS, or something similar.

On Fri, Apr 20, 2012 at 12:42 AM, fmaylinch <ferranmayli...@gmail.com> wrote:
> I know, Lance. :-)
>
> Yes, we already made a service that initializes the "static class" and
> exposes that functionality as a normal "non-static" service.
>
> Thanks for your help.
>
> So, we don't have any problem with this now. Anyway, I asked my first
> question just out of curiosity: is there a reason why @EagerLoads come
> before @Startup? Maybe to prevent people from using "static services"? ;-)
>
> Thanks a lot!
> On Apr 20, 2012 9:27 AM, "Lance Java [via Tapestry]" <
> ml-node+s1045711n565355...@n5.nabble.com> wrote:
>
>> Mutable static data is the root of all evil ;)
>>
>> Statics are (almost) impossible to mock and make testing and clustering
>> very difficult. Is there any way you could refactor your code to use a
>> singleton service instead of the static?
>>
>> You could then @EagerLoad the singleton service or initialize it in a
>> @Startup method and leave the other services to lazy load.
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://tapestry.1045711.n5.nabble.com/Why-EagerLoad-services-come-before-Startup-methods-tp5651302p5653558.html
>>  To unsubscribe from Why @EagerLoad services come before @Startup
>> methods?, click 
>> here<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5651302&code=ZmVycmFubWF5bGluY2hAZ21haWwuY29tfDU2NTEzMDJ8LTIwNzk2MDg1MzA=>
>> .
>> NAML<http://tapestry.1045711.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> --
> View this message in context: 
> http://tapestry.1045711.n5.nabble.com/Why-EagerLoad-services-come-before-Startup-methods-tp5651302p5653577.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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

Reply via email to