Leave a Reply

26 Comments on "Spring Boot Quick Start 20 – Implementing Update and Delete"

Notify of
avatar

Wayne Covell
Guest
Wayne Covell
1 month 6 days ago

For those asking for a simpler expression for the updateTopic, you can use: public void updateTopic(String id, Topic topic) { topics = topics.stream().map(t -> { return t.getId().equals(id) == true ? topic : t; }).collect(Collectors.toList()); }

Prasad Amberkar
Guest
Prasad Amberkar
12 days 4 hours ago

Which one is more efficient performance wise? for loop or lambda expression?

Sireesh V
Guest
Sireesh V
1 month 11 days ago

We can make use of @GetMapping, @PostMapping, @PutMapping and @DeleteMapping in place of @RequestMapping(method=RequestMethod….)

Guram Kankava
Guest
Guram Kankava
1 month 16 days ago

Thank you very much. clear and simple. "Everything genius is simple".

Niroz Jung Karki
Guest
Niroz Jung Karki
1 month 19 days ago

How can I use Lambda expression inside update method instead of For Loop.

Niroz Jung Karki
Guest
Niroz Jung Karki
1 month 4 days ago

Thanx Wayne !!

Wayne Covell
Guest
Wayne Covell
1 month 6 days ago

Please see my latest comment for this answer.

Bharath loka
Guest
Bharath loka
1 month 24 days ago

So if I want to update the id I have to compare all other fields and if all of them matches I can update the id right. Is there any other way to do it

Bharath loka
Guest
Bharath loka
30 days 23 hours ago

I got it now we can update the id in the request body itself

Wayne Covell
Guest
Wayne Covell
1 month 2 days ago

Bharath loka you just update using the I'd You want to update, but set a new ID in the topic. Next time you do a search for that first ID, you'll see it no longer exists but the new ID is there

Bharath loka
Guest
Bharath loka
1 month 3 days ago

Wayne Covell you used a lambda expression that is good but what if you want to update the id ?

Wayne Covell
Guest
Wayne Covell
1 month 6 days ago

Please see my latest comment for this answer.

Irakli Tabagari
Guest
Irakli Tabagari
2 months 27 days ago

Hi,Is Spring "@Service" always "@Singleton" by default??

Sergey Orlovich
Guest
Sergey Orlovich
4 months 14 days ago

You're mistaken in using PUT for update. PUT is used for insert in RESTful api, and POST is for update. Nice tutorial.

aditya nehra
Guest
aditya nehra
24 days 21 hours ago

kar di na chutiyo wali baat

Priten Vora
Guest
Priten Vora
3 months 29 days ago

Actually, it is mentioned in the stackoverflow page that If client decides the URL of the object being created then it is okay to use PUT otherwise we can use POST for resource creation. However using POST for update is not the REST way to go.

Rama41222
Guest
Rama41222
3 months 29 days ago

@sergey lol You must be dreaming

Priten Vora
Guest
Priten Vora
4 months 13 days ago
Avijit Chatterjee
Guest
Avijit Chatterjee
6 months 24 days ago

Thanks a lot for this great tutorial, it was a huge help. It would be great if you could add a section on integrating Swagger into this app.

anup kumar
Guest
anup kumar
6 months 30 days ago
Very nice videos , very well explained :)One quick question : Can you please discuss the scenarios of thread saftey ?Scenario i would like you to cover and explain : 2 parallel Put request comes in and at the same time the Get Request comes in too .. Put Request 1 : {id = Java , XYZ…. }Put Request 2 : {id = Java , PQR….}Get Request 1 : {/topics/{java} }what would be the output ? and how thread saftey is handled ? … I am going through your tutorials now , once i am done will try this out… Read more »
Priten Vora
Guest
Priten Vora
4 months 13 days ago

Ideally you should get {id = Java , PQR….}

Vishwanath Gajavelly
Guest
Vishwanath Gajavelly
4 months 16 days ago

this is interesting, did you figure out anything reg the synchronization Anup ? Thanks..

shalini lakshkar
Guest
shalini lakshkar
7 months 18 days ago

These tutorials are pretty simple… very well explained.. Thanks.

wpDiscuz