BriteSnow / snow

A Lightweight, Google Guice, Simple, and Powerful Web Application Framework that makes building modern Web Application a breeze! Fully open source, Apache V2 licensed.
http://britesnow.com/snow
29 stars 10 forks source link

Add support for Guice parameter injection for dynamic Snow Web methods (@WebModelHandler, ...) #8

Closed jeremychone closed 11 years ago

jeremychone commented 11 years ago

Currently (1.9.9): Only parameters that have been bound with the snow @WebParamResolver (the default ones or the application ones) can be injected in all the Snow "Web Methods" that supports dynamic signature (meaning the @WebModelHandler, @WebActionHandler,..)

Future (2.0.0): Add support for having Guice managed binding in Snow "Web Methods" and the capability to mix and match. The Snow WebParam resolver will take precedence, and then fall back to Guice injection.

For example, you can have

@WebActionHandler
public void processPaypalPayment(@WebUser User user, 
                                  @WebParam("amount") Float amount, 
                                  @PaypalCardProcessor CreditCardProcessor creditCardProcess){
...
}

Here the User and Amount and bound with Snow (with the default @WebParamResolvers), ad the CardProcessor is bound by Guice.

more info: https://plus.google.com/u/0/+JeremyChone/posts/fCTRfguHaYg

jeremychone commented 11 years ago

Published to 2.0.0-SNAPSHOT