Di 15 Dez 2009
Comparison of the MappingJacksonJsonView and spring-json view
Posted by kaiulrich under Java1 Comment
A MappingJacksonJsonView (springframework ) and spring-json view comparison
Since release 3.0.0.M4 the springframework provides an own json-view - MappingJacksonJsonView. It is based on the Jackson Java JSON-processor http://jackson.codehaus.org/.
The last release of the project was spring-json-1.3.0. http://spring-json.sourceforge.net/. It provides some more universal and advanced filter capilities.
For testing I used the modification spring-json demoapp and swapped the view components.
Here my comparison result:
| springframework MappingJackson JsonView | spring-json / sojo | spring-json / json-lib | spring-json / xstream | |
| version | 3.0.0.M4 | 1.3.0 / 0.5.0
| 1.3.0 / 2.2.3 | 1.3.0 / 1.3 |
| Streamingsupport | X | X | ||
| JSON Hijackprotection | X | X | X | X |
| CustomConverter | X | X | X | |
| Global- and Feld-Errors | X | X | X | |
| exceptions | X | X | X | |
| exclude properties | X annotation / view property | X view property | X view property | X annotation / view property |
| speed | ++ | 0 | 0 | + |
| conformants | ++
| 0 no boolean isSetter, Enumeration, sm | ++ javascript functions | ++
|
| annotation support | ++ | no | no | + |
| licence | GPL / ALS | Apache2 | Apache 2 | Apache 2 |
| Maven2 repro | SpringSource Enterprise Bundle Repository | Maven 2 - central repository / spring-json project repository | Maven 2 - central repository | Maven 2 - central repository |
| Customizing Behaviour | 0 | 0 | + | ++ |
The strength of spring-json view the good integration to spring-mvc. It provides the same binding- and validation capabilities like we now from the JstlView. It supports the Custom(Value)ConverterRegistration and error- and exception-handling.
MappingJacksonJsonView is very fast and has a good annotation support.
Fazit:
spring-json view is well designed to swap a "classic" spring-mvc application to a Web 2.0
application just by changing the view while keeping the back-end
almost unchanged. If you start a new Web 2.0
application you can use your "old" spring-mvc knowledge to design complex json communication easily.
MappingJacksonJsonView is a very fast and quick to develope way for representing a model as a json-stream. no more and less. It strickly follows the new way of spring configuration by supporting spring-mvc and jackson anotations.
Great comparison.This will definitely solve the problems of readers regarding both.Thanks for sharing.
Posted by kenia tee on December 22, 2009 at 02:20 PM CET #