What are admin UIs for spring-boot with mongoDB, providing CRUD operation like django-admin? - mongodb

I am implementing a new spring-boot application with mongoDB, earlier worked with djangoAdmin. Looking for a similar solution which can easily generate management UI for all classes decorated with #document.

Have you seen JHipster?
It uses an Angular frontend with a Spring Boot backend but comes with a ton of admin functionality right out of the box. This includes the turn-key CRUD operations like you mentioned.

There is http://lightadmin.org project. But it currently supports only Spring Data JPA.

Related

Is it possible to use both Spring Data R2DBC and Spring Data JPA in a single Spring boot application?

I have an application which is using Spring data JPA and hibernate envers for db auditing.
Since R2DBC doesn't support auditing yet, is it possible to use combination of both in a single application?
If yes, Plan is to use Spring Data JPA for insert, update and delete operations, so that all DB auditing will be handled by hibernate envers. And use R2DBC for reactive non-blocking API's to read data.
If no, Is there any suggestions on how to achieve both reactive API's and auditing?
Spring provided simple Auditing via #EnableR2dbcAuditing, check my example.
Mix JPA in a reactive application is also possible, I have an example to demo run JPA in a reactive application, but not added r2dbc in it.
For your plan, a better solution is applying the cqrs pattern on the database topology, use database cluster for your application.
JPA for applying changes, use the main/master database to accept the modification, and sync changes to the secondary/slave database.
r2dbc for queries as you expected, use the secondary/slave database to query.
use a gateway at the front for the query and command service.
Update: I have created a sample to demo JPA and R2dbc coexistence in a single webflux application. But I do not suggest using it in real-world applications. Consider the 3rd solution above if you really need it.
Yes it is possible however you will probably face two issues, one is that multiple repos modules handling needs to be explicited (e.g specify the paths of the respective modules).
Secondly, the JDBC/JPA Spring Boot autoconfiguration will be disabled and you need to import it back.
Those issues have been reported in Reactive and Non Reactive repository in a Spring Boot application with H2 database
And a solution to them and the thought process can be found in this issue:
https://github.com/spring-projects/spring-boot/issues/28025

#SpringBootTest how to pre-populate embedded MongoDB?

Doing implementation of a microservice with a few endpoints based on Spring Boot and MongoDB and trying to write integration tests using #SpringBootTest annotation capabilities.
At the moment, I am facing an issue that I need to pre-populate an embedded MongoDB instance that instantiated only during 'test' phrase with some test data.
And I did not find any out-of-the-box option available in Spring Boot for this purpose.
Some people advice to use for test data pre-populating tools like mongobee or mongoprefill or nosql-unit but for me, it seems like overhead or workaround, do not want to introduce any new dependencies even in test scope.
So could you please advice: In the current Spring Boot ecosystem, what is the right way to pre-populate MongoDB for testing purpose, when we are talking about integration (end-to-end) testing with #SpringBootTest?
There are multiple ways to pre-populate data:
Use the JUnit lifecycle methods like #BeforeEach, #BeforeAll to fill in data
You could disable the Spring Boot autoconfiguration for the embedded MongoDB and do it on your own and insert data after creating the connection
You could somehow mirror the #Sql feature we have for testing relational databases and write something similar using the AsbtractTestExectuionListener. For this have a look at the Spring class SqlScriptsTestExecutionListener
Provide a class that implements the CommandLineRunner interface and only activate this bean for your integration test profile with #Profile("integration-test")

Recommendations for a Full-stack Framework for REST?

I am looking for a robust REST framework to eliminate all that boilerplate code with starting up a new REST-only web service (mobile clients). Is there a framework that already has this built-in where I could, for example, simply build the domain models and run with it? I would like to see:
Authentication & User Model
Logging
Basic CRUD
Permissions (for model access)
Scalability
It seems every web service at a minimum needs the above capabilities. Somebody, somewhere must have written a good re-usable framework with the above capabilities. Any ideas? I would prefer Node.js, Java or even hosting with a PaaS service provider that offers these features.
Spring 3 MVC provides a very nice and simple annotation based framework for REST.
See http://blog.springsource.org/2009/03/08/rest-in-spring-3-mvc/ it can be deployed on any java web server like Jetty or Tomcat.
A framework like XAP provides a combined solution of Spring and Jetty plus it's built for dynamic scaling.
See http://www.gigaspaces.com/xap.
Last if you want to easily on board this solution on any cloud CloudifySource provides an open source project which includes XAP capabilities and PaaS.
See http://www.cloudifysource.org
I use Symfony 1.4 for this. It is an PHP framework. It generates most of what you need for free. The database stuff is also quite easy as the Symfony uses ORM libraries (you can choose but I can recommend Doctrine: http://www.doctrine-project.org/).
For example the whole backend site(admin) generating is a matter of running one command. They have a great e-book fro free. More info here:http://www.symfony-project.org/.
There is also Symfony 2.X (http://symfony.com/), which have a lot of new features (e.g. new Doctrine 2.0). Especially with the bundle (plugin) https://github.com/FriendsOfSymfony/FOSRestBundle is the RESTful service quite easy.

Restlet + mongoDB + Freemarker

We are making a web based application in Java that should be accessible to any device and so we zeroed in for Restlet for our REST based web service need.
For UI we are thinking of Freemarker together with Twitter bootstrap and database will be mongoDB. And guice for dependency injection.
Since I am new to most these technology stack, do you think this is fair choice for a long run. Also, for database mapper framework we decided to use Jongo it seems lightweight. Kundera is an option but it has lots of dependency. What you expert say ?
"Kundera is an option but it has lots of dependency." Not sure what do you mean by this statement? could you please explain it more?
Please take a look at https://github.com/impetus-opensource/Kundera/wiki/Kundera-Mongo-performance for performance using Kundera!
It really depends on your needs
REST Framework :
IHMO you should test at least theses 3 JAX-RS Frameworks : RestEasy / Jersey / Restlet and choose the one according to your needs.
JAX-RS Frameworks
https://stackoverflow.com/questions/1710199/which-is-the-best-java-rest-api-restlet-or-jersey
UI :
I've worked with Jersey + Freemarker through a framework called Webengine from Nuxeo, it was ok.
Nevertheless, you should consider a rich client approach based on Javascript/CSS/HTML (see Backbone.js, Ember.js)
Pros :
With such approach you could expose JSON REST services using a JAX-RS Framework (instead of freemarker/html services) .
Theses services can be consumed by a web application and/or native mobile apps (ios, android).
Cons:
Your team must have advanced javascript skills (this blog can help )
Database :
What kind of data do you need to store ?
MongoDB is document-oriented and flexible enough to cover lots of needs
As you said, Jongo is a lightweight API (500 lines of code + 1 dependency) over mongo-java-driver.
It allows you to query MongoDB as if you were in MongoShell (ie. with plain json/bson queries) and map your object using jackson.
This question is a good example: Mongo DB query in java
Relying on Restlet Framework for your RESTful web API/service backend sounds like a good choice for a multi-devices application. FreeMarker is very powerful and flexible so you should be in good company there as well.
I don't know too much about the other pieces of your stack.

Spring Data JPA and SimpleJPA/SimpleDB

I'm wondering if it is possible to specify SimpleJPA as the persistence provider used by Spring-Data-JPA. I'm not a JPA expert so I hope this question isn't silly. Is it as easy as just specifying SimpleJPA's entity manager factory in the persistence.xml? I have yet to find anywhere online where someone has used Spring-Data-JPA to connect to Amazon's SimpleDB, I would love it if someone could point me in the right direction.
I just found this project and got it working for our Spring Data + SimpleDB needs:
https://github.com/3pillarlabs/spring-data-simpledb
The documentation is pretty good and getting things up and running was pretty straight-forward. I was accessing SimpleDB via Spring Data with about 10 minutes of work.
Generally setting up your persistence provider is just a matter of setting up the EntityManagerFactory through your Spring context (in case you use the Spring container). Thus have a look at how to configure EntityManagerFactory instances in Spring.
There might be the need to implement a custom JpaVendorAdapter to let Spring use the SimpleDB JPA implementation correctly. For some advanced functionality (e.g. using pagination with manually defined queries) we'd have to tweak the Spring Data JPA codebase a bit. If you'd like to see that supported feel free to open a ticket in our JIRA.