Recovery Java WEB MVC frameworks

Well, I know that there are similar threads, but I think this is one thing. First, I come from the world of C ++ desktop development, so naked with me if I don't get all the terminology.

The application that I am developing will "respond", make asynchronous communication, and transmit a lot of JSON back and forth.

I need a Java MVC WEB environment that supports

1) Minimum amount of BLOAT and "backstage". There is always a trade-off between infrastructure functionality and complexity in any infrastructure. But when the time comes, when I am faced with a problem and must “fight with the framework” (and this time always comes), I want this to be an honest battle. Minimizing the size of the frame increases the likelihood of a fair fight.

2) Native support for RESTFUL . That is, route html verbs and perform content negotiation.

3) Simple support for JSON processing . Using an arbitrary json processor of my choice, i.e. Jackson or gson etc.

4) Simple sustainability support , for example. Jpa etc

5) Some template systems , for example. freemarker, speed etc

6) Native role-based authentication / authorization system with security support OR Spring Integration with Security

All of the above should be integrated into the structure. Not in some third-party user module that dismisses when a new version of the framework arrives.

I sat down for a day and experimented and found the following candidates

Spring MVC 3

1) To get the “Hello World” example in the preface and run it in spring MVC 3, I need the following banks:

  • org.springframework.beans-3.1.0.RELEASE.jar
  • org.springframework.expression-3.1.0.RELEASE.jar
  • org.springframework.asm-3.1.0.RELEASE.jar
  • org.springframework.context-3.1.0.RELEASE.jar
  • org.springframework.core-3.1.0.RELEASE.jar
  • org.springframework.web-3.1.0.RELEASE.jar
  • org.springframework.web.servlet-3.1.0.RELEASE.jar

And finally, some definitions in the xml file, "dispatcher-servlet.xml". I don't know if this explains BLOAT or too much behind the scenes. But that does not give me a warm and fuzzy feeling that I feel a little controlled.

2) spring 3 supports this and from the examples , I saw that it does not look too nasty

3) It is supported, but from the link in (2) it seems that json processing is limited to using the jackson library. At least if you want to use magical annotations to harmonize content.

Quote:

"Under the covers, spring MVC delegates the HttpMessageConverter to serialize. In this case, spring MVC calls the MappingJacksonHttpMessageConverter built on the Jackson JSON processor. This implementation is activated automatically when you use the mvc: annotation configuration item with Jackson present in your class path. "

Warning bit for me. I would like to have clear programmatic control over which JSON processor I use. Maybe I missed something. This qualifies as unwanted “backstage magic” in my book

4) Yep

5) Yep

6) Yes

Play framework

1) Version 1.2 weighed 88.5 MB on my disk. It does not start in the servlet container, so getting the hello world example and working was easy peasy compared to spring, where even figuring out which boxes I needed were hidden in secret. Obviously, a lot of things are happening behind the scenes in the game. I think all I can hope for is that he does not do more than necessary. And that architecture is reasonable. But when will I ever struggle with the carcass, will I be dead upon arrival? Who knows...

2) Yes, and it is so elegant. Thumbs up.

3) Yes, but it uses gson under covers. Again, why can't I control this programmatically? Fortunately, you can pass an arbitrary serializer to gson to override the default value. And I think this parameter displays the second parameter of the renderJSON () function. So the games go with half a finger up.

4) Yes. Has a JPA module

5) Yes. Uses groovy. Fine.

6) A combination of secure modules and deadbolt modules should be possible. I don't know how well it combines with spring security. I do not see the built-in support for password encryption and the like. And I can’t imagine how difficult (if possible) it would be to integrate with spring protection. I don’t know if it will be more convenient to deploy sensitive data and rely on the game! security framework. It was probably necessary to build something on top of it.

Restlet

Maybe a special candidate that he sold to use for "hectic web services." But for my points (1) - (6) and my type of application, where most of the user interaction is asynchronous, it seems to be suitable. I can run it on static resources or dynamically generated content and spit out any type of content.

1) Restlet 1.1.1 is about 54 MB. He looked at the welcome example of the world. I liked the lack of XML files. And just like playing, it has its own server (berth connectors). The greeting example was very clean and light.

2) Yes, and the approach is very "software"

3) Yes, but this only seems to be via the jackson extension module . Given the programmatic nature of this structure, it seems likely that there are other options, but I have not found anything in the documentation or on user group forums.

4) Describes himself as an "agnostic of resistance." OK, I think. But I want to persevere and not reinvent the plumbing myself. Or at least I want to show a little that this can be done with some effort. There is a third-party jpa module, but it is built on restlet 1.0. Restlet has a spring module, although maybe I can integrate with spring persistance stuff ...

5) Yes, there is a freemarker extension

6) There is a proprietary scheme for this. A fist look, and not as "rich" as spring security. Again, maybe I can integrate?

ESSENCE

Spring MVC 3 . Supports all requirements, with the possible exception of (1). My only concern is that it seems complicated, and I get a vague, unpleasant feeling of uncontrollability. I really don't want to get stuck in the structure later, as my application grows.

Play : A very pleasant experience. Even fun. If only the security scheme was more advanced or I could at least integrate with spring protection (and find documentation on how to do this)

Restlet For some reason, this circuit resonated with me. The programmatic approach evokes a sense of control. But if I can’t persevere in some simple way, then it won’t . I can not understand why this is not built-in. Doesn't everyone need this?

  • What do people who used any of the above structures say?
  • Are my observations accurate?
  • Didn't I leave the framework that should be here?
  • Alternatives?

Greetings

+7
source share
3 answers

the comparison between Spring and Play is now very outdated, since Play 2.0 has been rewritten in Scala and is better in almost every possible way.

Check it out: http://www.playframework.org/

+3
source

Here I can only speak for Spring.

When I was forced to use Spring for a non-REST project last year, I cringed. Not only did I only have a few days to find the basics, I didn’t like all the “magic” he did, and I was not familiar with the principles of IoC.

But he grew up on me. I also became very fast. Since then, I have used Spring for all kinds of web projects, including the one that provides the RESTful API.

Spring's strengths are, from my point of view: a) it is actually quite lightweight and usually does not work as soon as you have configured things; b) TONS of examples and a great community to support; c) REST is a cinch as soon as you get the correct configuration, d) an API design that makes the gods cry with joy, and e) IoC changes life.

Speaking of your concern about bloating ... I used other web frameworks for Java, and Spring is the least bloated of all IMOs. It may look like a lot, but it really is not. Compared to Struts and Seam (both of which I still have nightmares), Spring runs counter to bloating. In addition, IoC will let you go without having to write tons of templates, making your application less bloated.

You mentioned that you do not want your application to grow. This will not happen in Spring, I guarantee you. It is designed to stay out of the way and not depend on any one frame. Your code - if it was designed correctly - could fall Spring in the future for something else that didn't have a lot of curses and dizziness. This contributes to an agreement on the configuration, which means that ordinary material should work out of the box without having to move too much. For those things that are against the wall, this gives you enough rope to hang yourself.

In summation, I would consider Spring.

+1
source

I can recommend RESTlet 2.x , which I use for each project. And RESTEasy , which I am considering for use in the upcoming project.

What I like about RESTlet, all routing is in one place. This is a very feature rich app .

What I don’t like about RESTEasy, and I didn’t look at it so deeply, in the annotations there is every routing scattered around the code base for each method, of which there can be many classes. Not having them all in one place will make maintainability difficult.

Why am I still considering RESTEasy, having several GET methods for each class can reduce the class to an explosion of the resource class that can happen in a RESTlet.

Both are JAX-RS compatible, if important, and one of them is a solid investment in time and functionality.

Regarding templates, use StringTemplate , avoid things like FreeMarker, they just lead to a world of maintainability pain.

0
source

All Articles