Spring Boot WebFlux | Spring Data Reactive MongoDB -CRUD Example | JavaTechie

  Рет қаралды 39,370

Java Techie

Java Techie

3 жыл бұрын

This tutorial will walk you through how to write CRUD operations for a Spring Boot application using reactive mongodb driver.
#javatechie #reactive #mongoDB #Webflux
GitHub:
github.com/Java-Techie-jt/spr...
Blogs:
/ javatechie4u
Facebook:
/ 919464521471923
guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
Disclaimer/Policy:
--------------------------------
Note : All uploaded content in this channel is mine and its not copied from any community , you are free to use source code from above mentioned GitHub account

Пікірлер: 97
@samuelsodagudi
@samuelsodagudi 3 жыл бұрын
Thank you soo much for making this video. 🙏🙏🙏
@javatutorialshub8896
@javatutorialshub8896 3 жыл бұрын
You are explaining very easy way. keep growing. 👍 👍
@PavelQuezada
@PavelQuezada 3 жыл бұрын
nice tutorial, thank you soo much, greetings from Perú
@mahimakaushal7381
@mahimakaushal7381 Жыл бұрын
very very nice video everything was so clear reactive was new for me but this video cleared everything.
@amitkumar7566
@amitkumar7566 3 жыл бұрын
Very clear. Waiting for your video on SAGA pattern of microservices.
@johncerpa3782
@johncerpa3782 3 жыл бұрын
Great video!
@gabrielgitonga1252
@gabrielgitonga1252 3 жыл бұрын
Awesome, this is awesome. I love the way you teach. Always following you.
@Javatechie
@Javatechie 3 жыл бұрын
Thanks Gabriel ,👍
@gabrielgitonga1252
@gabrielgitonga1252 3 жыл бұрын
@@Javatechie You are welcome.
@diggusbickus
@diggusbickus 10 ай бұрын
Genius, thank you.
@ogabeksaidov1986
@ogabeksaidov1986 2 жыл бұрын
Simple GREAT👍
@karismachoudhury222
@karismachoudhury222 2 жыл бұрын
Thanks for the nice video
@sreesri8492
@sreesri8492 3 жыл бұрын
Your videos are very easy to understand, even for freshers. I always advice my frd to watch your videos. Thank you
@elizeuramos2371
@elizeuramos2371 2 жыл бұрын
thanks so much, very very nice video
@HallOfMemeYT
@HallOfMemeYT 2 жыл бұрын
no tutorial can be better than this.i used traditonal mysql database with the reactive rest service..Thnx for the tutorial
@Javatechie
@Javatechie 2 жыл бұрын
Thanks buddy . If you want to use traditional MySQL DB then please go with R2DBC
@vengateshm2122
@vengateshm2122 2 жыл бұрын
Well said
@raghuvardhansaripalli9636
@raghuvardhansaripalli9636 3 жыл бұрын
Hi Basanth, if you have time, could you please do a complete spring cloud gateway with resilence4j, load balancing, security, authentication, routing, filters using 2 Microservices..thank you in advance..stay safe..🙏❤️
@AshishYadav-se4db
@AshishYadav-se4db 3 жыл бұрын
Thank you so much sir.
@khemchandkolhe3
@khemchandkolhe3 2 жыл бұрын
great tutorial
@bryanseros
@bryanseros Жыл бұрын
Thanks!!! for you help
@musa4747
@musa4747 3 жыл бұрын
Thank you brother
@tamizhvananasaithami5021
@tamizhvananasaithami5021 3 жыл бұрын
thanks for your material looks pretty simple and easy understandable. need your input the below example
@michaeldeng1981
@michaeldeng1981 3 жыл бұрын
Great. Only thing want to point out is the controller class path is not fully restful, should follow the rest urls conventions. For example, no need to write "update" in the url.
@Javatechie
@Javatechie 3 жыл бұрын
Thanks but once I defined root url as /products then do you really need to define /product again ?
@michaeldeng1981
@michaeldeng1981 3 жыл бұрын
@@Javatechie /products should be fine.
@pratishrutipanda6461
@pratishrutipanda6461 3 жыл бұрын
Nice video sir
@SivaKumar-gl9ty
@SivaKumar-gl9ty 2 жыл бұрын
Thanks!!..
@krishind99
@krishind99 Жыл бұрын
Great work. Thanks for putting this together. How do you do error handling in each stamp. What happens if insert or update fails. What if, ID you are looking for is not found?
@subramanianchenniappan4059
@subramanianchenniappan4059 2 жыл бұрын
Thanks
@mayanksharmaisrolling
@mayanksharmaisrolling 3 жыл бұрын
Hi nice video, do you see any performance improvement while using reactive programming ? I mean in this example although you are using reactive programming , the responses are not streamed(as you did in the previous tutorial). so what benefit you see for using reactive for this use case vs traditional rest and non reactive programming?
@edgarfranklizarragaugarte1191
@edgarfranklizarragaugarte1191 2 жыл бұрын
same question here... I used APPLICATION_STREAM_JSON_VALUE to produce it an it works but it is deprecated
@rajkumardas8776
@rajkumardas8776 2 жыл бұрын
same question from my side as well.
@rajkumardas8776
@rajkumardas8776 2 жыл бұрын
I know the answer now! By default browser donesn't understand that this is a stream API so you are not seering the streaming behavior though it is in really. You need to include the produces as APPLICATION_JSON_STREAM_VALUE if you want to see the behavior in browser. In practical, we don't need that becuase the call happens in services only.
@ainigma100
@ainigma100 3 жыл бұрын
Great job!!! Thank you for your video! I just have one question. Maybe it is a better (safer) approach to use a constructor-based injection. What do you think?
@Javatechie
@Javatechie 3 жыл бұрын
I am directly using annotation approach
@javabites
@javabites 3 жыл бұрын
In general, constructor based annotation is for mandatory dependencies. Setter Injection is used for optional dependencies.
@ainigma100
@ainigma100 3 жыл бұрын
@@javabites Thank you!!!
@thefaizanakhtar
@thefaizanakhtar 2 жыл бұрын
If we are returning content type application/octane stream file in return from server to client using web client what return we should give in bodytoflux()
@ajinkyarawankar3245
@ajinkyarawankar3245 3 жыл бұрын
Can you make video on how to save and retrieve nested objects. Saving nested objects separately and build the complete object while retrieving parent object.
@ShauryaChawlaprayforplagues
@ShauryaChawlaprayforplagues Жыл бұрын
Hey thanks for this tutorial! I made a mini app with a Thymeleaf form to input data. When I call the save method, the data is not saved. But when I add a .subscribe() method after the actual repo insert(), it saves. I don't see you using the subscribe() method. What am I missing here? Please help!
@chiragmatta9171
@chiragmatta9171 2 жыл бұрын
Can you please make tutorial on reactive programing with Kafka and ActiveMQ
@bharatbhaisolanki3081
@bharatbhaisolanki3081 2 жыл бұрын
Reactive Repositories are not supported by JPA. Offending repository with mysql - @Query("from Product where price between ?1 and ?2 ")
@Javatechie
@Javatechie 2 жыл бұрын
Not sure about current version
@shivaniKadali
@shivaniKadali 24 күн бұрын
we are created the Entity. then what is the use of create DTO with same fields? and another question is i am trying to postmapping it gives responce as 200 but its not saving to DB , rest of the endpoints are working properly
@Born_2_Reflect
@Born_2_Reflect 3 жыл бұрын
please provide the link for using Mongo DB using Docker Compose and integrate testing webclient for webflux ?
@debasismaharana2314
@debasismaharana2314 2 жыл бұрын
We need mongo db vedio. Please make one .
@Javatechie
@Javatechie 2 жыл бұрын
Please check in my spring boot playlist it's already there kzbin.info/www/bejne/oWazlqytmMeJj8U
@vinodhreddy6227
@vinodhreddy6227 3 жыл бұрын
How we can exstract mono to pojo ans flux to list of pojo?
@jaganreddy17
@jaganreddy17 2 жыл бұрын
Can you do Video on Spring webflux with reactive rabbitmq?
@vemulavamsikoundinya
@vemulavamsikoundinya 9 ай бұрын
Hi Basanth, you are doing great job. How to work with entity mapping with ReactiveCrudRepositoy, isit same as JPARepository?
@Javatechie
@Javatechie 9 ай бұрын
Yes same only it will differ with return type like mono and flux other than that not much difference
@vemulavamsikoundinya
@vemulavamsikoundinya 9 ай бұрын
Hi Basant, if possible could you please provide example on mapping with ReactiveCrudRepositoy.
@Javatechie
@Javatechie 9 ай бұрын
Okay i will
@tamizhvananasaithami5021
@tamizhvananasaithami5021 3 жыл бұрын
Spring Data Reactive MongoDB -CRUD Example for one to many or many to many examples relation . can you give some inputs
@reddy8870
@reddy8870 2 жыл бұрын
Great, how to convert Mono to List ? Without using block()
@prileepmathan8144
@prileepmathan8144 2 жыл бұрын
Can you add videos about Spring Reactive R2DBC with Oracle Database?
@Javatechie
@Javatechie 2 жыл бұрын
Yes I will add buddy
@edgarfranklizarragaugarte1191
@edgarfranklizarragaugarte1191 2 жыл бұрын
is the JSON that returns to the client(browser) blocking others requests? I raised this question since you used TEXT_EVENT_STREAM_VALUE to provide values...
@Javatechie
@Javatechie 2 жыл бұрын
No it won't Block it keep publish stream to the client
@fipabrate
@fipabrate 2 ай бұрын
I had the same question
@severessnape9821
@severessnape9821 3 жыл бұрын
Nice video, but I don't understand why you took entity and dto separately (and performing conversion operations separately in utils) ? Is that a convention or something? Can we not use Entity directly?
@Javatechie
@Javatechie 3 жыл бұрын
No this is the recommended industry standard you shouldn't use Entity directly
@manikantatikkisetty3594
@manikantatikkisetty3594 6 ай бұрын
I do have same question. What is the difference between both.
@josephjesusflorianflores7089
@josephjesusflorianflores7089 2 жыл бұрын
hi, how would he use the saveAll method that saves several documents but not DTOS?
@Javatechie
@Javatechie 2 жыл бұрын
For several documents you must need to create multiple repository .so each repo have their save all method
@ARPITGUPTA-sx1hr
@ARPITGUPTA-sx1hr 2 жыл бұрын
Hi when i try to run the application It is showing error: cannot find symbol .doOnNext(e->e.setId(id))) ^ symbol: method setId(java.lang.String) location: variable e of type com.example.demo.entity.Product Could you please tell me how to resolve this ??
@prateeknima3388
@prateeknima3388 Жыл бұрын
Hi Basant, Thanks for the video. I have tried creating a sample application but I get the socket connection error [localhost:27017] org.mongodb.driver.cluster: Exception in monitor thread while connecting to server localhost:27017 com.mongodb.MongoSocketOpenException: Exception opening socket Do you have any idea regarding this?
@Javatechie
@Javatechie Жыл бұрын
Check whether your mong server is up and running or not?
@prateeknima3388
@prateeknima3388 Жыл бұрын
@@Javatechie Thank you for your reply. I was trying to utilize only the embedded repository so was wondering if spring would do the installation of embedded mongoDB?
@bikashpatra119
@bikashpatra119 4 ай бұрын
@@prateeknima3388 For embedded mongodb to work, you need to do the following changes in your application configuration Please note, I am using Spring 3.2.2. 1) Use the following dependency for embedded mongo in your pom.xml de.flapdoodle.embed de.flapdoodle.embed.mongo.spring3x 4.12.2 2. The flapdoodle would need the mongo version that it can bring up. We need to provide the mongo version in application.properties. de.flapdoodle.mongodb.embedded.version=7.0.0
@bikashpatra119
@bikashpatra119 4 ай бұрын
@@prateeknima3388 Seems someone deleted by reply here. Let me put it again. I am using spring 3.2.2 on mac In pom.xml you will have to use the below dependency de.flapdoodle.embed de.flapdoodle.embed.mongo.spring3x 4.12.2 In application.properties, we will have to provide version of mongodb de.flapdoodle.mongodb.embedded.version=7.0.0 Both these changes are needed to enable spring to start embedded mongo in your spring boot application.
@vinayakkajagar188
@vinayakkajagar188 2 жыл бұрын
Hi @JAVA_techie can you ans me , even if we don't send any body in put method means without json if we hit put api to update , it's saying 200 ok as response code , can you please explain what might be reason
@Javatechie
@Javatechie 2 жыл бұрын
It should give bad request error 405
@vinayakkajagar188
@vinayakkajagar188 2 жыл бұрын
@@Javatechie but its not giving me bad request , it's responding with 200 ok
@vinayakkajagar188
@vinayakkajagar188 2 жыл бұрын
It's depends on router function , is it?
@Javatechie
@Javatechie 2 жыл бұрын
Let me check if that is the case then we didn't implement properly
@vinayakkajagar188
@vinayakkajagar188 2 жыл бұрын
@@Javatechie ok
@rajkumardas8776
@rajkumardas8776 2 жыл бұрын
Can you please give your answer on Mayank's question below please?
@rajkumardas8776
@rajkumardas8776 2 жыл бұрын
I know the answer now! By default browser donesn't understand that this is a stream API so you are not seering the streaming behavior though it is in really. You need to include the produces as APPLICATION_JSON_STREAM_VALUE if you want to see the behavior in browser. In practical, we don't need that becuase the call happens in services only.
@sushilmadankar53
@sushilmadankar53 3 жыл бұрын
HI...How that findByPriceBetween is being executed? I meant where is its implementation code?..How it returns data exactly between those price ranges...some miracle is it?? please reply asap.Thank you in advance. Also, suggest where I can get familiar with these type of reactive coding
@Javatechie
@Javatechie 3 жыл бұрын
This is inbuilt code of spring data jpa and it's syntax
@sushilmadankar53
@sushilmadankar53 3 жыл бұрын
@@Javatechie Okay..but how that code knows I have to pick price field values, could you please suggest any link for reference??
@Javatechie
@Javatechie 3 жыл бұрын
Can you please check my spring data jpa tutorial
@sushilmadankar53
@sushilmadankar53 3 жыл бұрын
@@Javatechie please reply with the exact link of video, there are so many
@kwadwodwomoii8916
@kwadwodwomoii8916 Жыл бұрын
It's auto-implemented by Spring Data. It's the same for the other annotations.
@avinashavi6176
@avinashavi6176 2 жыл бұрын
Hi Sir, i have some douts, how can i contact you. is there any package,course, like that
@Javatechie
@Javatechie 2 жыл бұрын
javatechie4u@gmail.com
@nhatvu868
@nhatvu868 3 жыл бұрын
Thank you for those videos; they helped me a lot. But now I am struggling to solve my task which is: how to make the browser displays new document along with the old ones every time I insert a new document into my MongoDB, without refreshing my browser. Any solutions or keywords will help, thank you.
@Javatechie
@Javatechie 3 жыл бұрын
You need to use SSE (Server Sent Event) concept
@nhatvu868
@nhatvu868 3 жыл бұрын
@@Javatechie Thank you so much, I will check that out now
@itscaesar.794
@itscaesar.794 Жыл бұрын
Hi, I am getting the following error :- java.lang.NullPointerException: null at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na] Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): *__checkpoint ? HTTP POST "/games" [ExceptionHandlingWebHandler] Original Stack Trace: at java.base/java.util.Objects.requireNonNull(Objects.java:208) ~[na:na] at com.SpringWebFluxExample.service.gameService.saveGames(gameService.java:27) ~[main/:na] at com.SpringWebFluxExample.controller.gameController.saveGame(gameController.java:30) ~[main/:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na] at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na] at org.springframework.web.reactive.result.method.InvocableHandlerMethod.lambda$invoke$0 Can you please help me out with this.
@Javatechie
@Javatechie Жыл бұрын
Please debug and check
@itscaesar.794
@itscaesar.794 Жыл бұрын
@Java Techie Yes, done that. It turns out that the project structure was the culprit here. Thanks for the tutorial 👍
Получилось у Вики?😂 #хабибка
00:14
ХАБИБ
Рет қаралды 6 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 88 МЛН
He sees meat everywhere 😄🥩
00:11
AngLova
Рет қаралды 9 МЛН
What is Spring Webflux and when to use it?
17:46
Defog Tech
Рет қаралды 240 М.
Spring Boot CRUD Example using AWS DynamoDB
26:40
Daily Code Buffer
Рет қаралды 45 М.
Project using Java Spring Boot and MongoDB NoSQL Database
40:59
Reactive Programming with Spring Boot | A Beginner's Guide
40:31
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Ремонтяш
Рет қаралды 249 М.
APPLE совершила РЕВОЛЮЦИЮ!
0:39
ÉЖИ АКСЁНОВ
Рет қаралды 4,3 МЛН
Неразрушаемый смартфон
1:00
Status
Рет қаралды 1,9 МЛН
💅🏻Айфон vs Андроид🤮
0:20
Бутылочка
Рет қаралды 739 М.
#miniphone
0:16
Miniphone
Рет қаралды 3,6 МЛН