What can Spring Sync do?
A new Spring project has seen the light of day. Spring Sync has arrived to facilitate the communication between client applications and Spring-backends. How exactly does it work?
Spring has made a Sync Library available which can be produced with the patches and applied to Java objects, as Craig Walls explained in a Pivotal Blog post. Here, a patch-class acts as the central element, through which changes to an object can be tracked and synchronized with other objects.
The project is loosely based on the JSON Patch, the format for describing changes to a JSON document and can be updated by the HTTP PATCH method when targeted in combination with the HTTP APIs. This should support Spring Sync generation and serialization of patch instances such as JSON Patch. Future Spring Sync versions will be expanded to include alternative patch representations.
But that’s not all: On a higher level of abstraction Spring Sync provides synchronization of patches through a differential synchronization algorithm by Neil Fraser. So what’s on offer is a control mechanism for the generation and application of patches between multiple network nodes, which can for example consist of client and server, but also out of more complex scenarios.
Spring Sync 1.0.0 Milestone 1
Despite Spring Sync being new and this being its first release, it will already have reached the first milestone in the form of Spring Sync 1.0.0. It will include the implementation of patch abstraction for generating and applying patches to Java objects, support for the representation of patches as JSON patches and an implementation of differential synchronization.
Through the Spring MVC controller DiffSyncController, Http requests of type application/patch-json+patch and the application of differential synchronization can also be controlled as a resource.
The plan is to expand the HTTP-based differential synchronization through WebSocket/ STOMP support. In addition, you will hone the resource versioning to avoid patch conflicts. Craig Walls also envisaged providing support for the use of Spring Sync in Android applications.
Spring Sync is developed under the Apache 2.0 open source license; the project can be found under: http://repo.spring.io/libs-milestone-local/ (Dependency coordinates org.springframework.sync: spring-sync: 1.0.0.M1) and is also available on GitHub.