Spring data alternatives

We currently have an enterprise application that works with spring and JPA. Today we are planning the next generation server.

We are discussing whether to use spring-data in our project? This seems to increase productivity and development time.

Are there any alternatives to spring-data to consider? Why not use spring and JPA? What are you offering?

Remember that we are starting to develop from scratch, so there are no restrictions except:

  • we use mysql and mongoDB
  • code in java
  • we will develop client side code in GWT.

Currently we have a multi-level architecture. We have a service level and a manager level that takes care of constant and business logic. The one who built it did not find a good reason to insert a third layer of DAO.

+6
source share
1 answer

There are some technical advantages of Spring Data over Spring + JPA, which in a clean SQL environment, I think, give Spring Data an advantage:

  • Spring Data uses the same CrudRepository interface for all implementations, so you will have less effort to switch between JPA and MongoDB.
  • Spring Data saves re-writing the same methods. You just add a method to the interface and it will generate it for you (e.g. UserRepository.findByUsername ())
  • You can save the template for implementing REST for JPA, MongoDB and others (see http://projects.spring.io/spring-data-rest/ )
  • If you want to experiment with other persistence or indexing services, there are Spring Data implementations for both mature and new technologies, such as Neo4j, Hadoop, Solr, ElasticSearch, fuzzydb.

Given that you are using MySQL and MongoDB, I think Spring Data is a strong candidate, as it allows developers to code one Data Access API (Spring Data) instead of two (JPA and MongoDB Java Client).

As for the existing architecture, it sounds as if your manager level implements either a Rich Domain template or an Active Record.

Spring Data, in my opinion, is very well suited for Rich Domain in combination with the implementation of services using Spring @Configurable.

Finally, I would say that Spring Data also provides a significant advantage when you need to implement services for things like Spring Security and Spring Social that use MongoDB or others, rather than SQL.

We did this in the webapp fuzzydb example, which can be found here here . (Disclaimer: I am the only recent fuzzydb committer and have not touched it for several months, but we have a live service based on this code)

+2
source

Source: https://habr.com/ru/post/955671/


All Articles