Actually, I would recommend the following syntax instead:

public MyServlet {

private OtherServlet otherServlet

@Inject
public MyServlet(OtherServlet otherServlet) {
this.otherServelt = otherServlet;
}

// ...

}

Its ok to do the field injection, but the constructor injection is
recommended (I thought) over field injection, and is negligibly more
code...

On May 24, 1:04 am, Tristan <[email protected]> wrote:
> Here's how you'd do it using Guice on the server:
>
> public MyServlet {
>
>   @Inject
>   OtherServlet otherServlet;
>
>   public void someMethod(){
>     otherServlet.doSomething();
>     ...
>   }
>
> }

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to