I want to build an MVC app using Spring (first timer here).

As such I want to embed Jetty as the servlet engine. Jetty however doesn't strictly follow the java beans pattern, so I can't launch some classes from Spring (they use overloaded setters or non setter init methods like addXYZ).

What is the accepted/recommended practice for structuring this project? Obviously all my code fits nicely in the MVC model, but for Jetty:

  • Do I encapsulate all of Jetty (or any other non-bean friendly component) in my own Spring-friendly bean?

  • Do I try to instantiate as much of it as possible in spring and just extend classes that aren't bean con-formant to make them act like proper beans?

  • Should I use Java Config instead of XMLs in order to sidestep problems like overloaded setters and other non-bean issues?

  • Is there another option?