Wednesday, October 3, 2007

Integrating Guice and JSF (Part 2)

Checked in an improvement to the first pass. Using a custom ELResolver you can take advantage of setter injection and constuctor injection now.
 <application>
<el-resolver>
org.apache.myfaces.el.unified.resolver.GuiceResolver
</el-resolver>
</application>
Note: this will not work with the reference implementation and it requires JSF 1.2 . Thanks to Jacob Hookom for introducing me to the ELResolver class.

3 comments:

Alena said...

Hi Dennis,
have you ever tried your resolver with real managed bean which has some field members filled from web form? - it doesnt work

Marcel said...

Hi Dennis,

I like your solution, but see a big downside: It is implementation specific and furthermore it makes assumptions about how the other resolver work. I tried to think up a solution, that is not tied to a specific solution and makes less assumptions about the whole resolving process. Anyhow, this is only an idea. I'm for example not so sure if this handling is not slowing down the whole resolving process.

http://snippets.dzone.com/posts/show/7171

Anonymous said...

If you like to replace the jsf resolving with guice instead, here is a good solution:
http://code.google.com/p/jsf-sugar/

You can configure your "managed beans" still with a xml file (like you know it from jsf) and use the complete features of guice.