Spring Boot with PostgreSQL and Docker Compose | RESTful CRUD API Example | Spring Data JPA Auditing

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so so yeah so now what I'm going to be auditing so basically what is JP auditing so what does what does this so basically I come in the real-time applications been mightily be multiple people so having done that project ID so like couple of guys with what kind of saying audit so if someone will modify this project to get that information like to track that information so this spring would has been like introduced that future guys okay so what it will do is it will it will like saves the that user information like who are like modified that project so that information like created it and created by and updated it and updated by time so will save in the database along with this entity class okay so what we need to do is we have to write like Feud for surplus and we have to enable few annotations okay so this will help you she feels one is created it updated it okay and created by an updated way so these values will say well I'll give this our employee IBM name so that's what I'm going to do and we have another bias okay this entity is not what it will does this so this entity is in a will this entity listener will like so persistent it is along with so this class will be extended by the other entities so it can dance like entity listen outside this and reduction will be automatically populated created and appropriate values when the entities are persisted so when the employee employee Pozzo classes for sister so along with this ID and name so it will persist this great identity created and updated it and created and operated by values so that's what this entity has happened oh guys so [Music] so that's it so this imply audit is ready so to persist this values so we need to exchange this employed class here okay so that's it and finally we need to enable the JB all written here so now so here the employed clubs we have like created it and updated so these values so by default like it will pick the system time so what I would like created by an operator with these values will be picked by the spring good security context but I am NOT going to use the spring context here of a spring good security context so to obtain this value so we need to write one one more class and we have to implement okay so that's so let me write that so that class so this class will have two so we have a method so this gate current or not it doesn't matter so much because it will update the name I think tom so whenever like you want entities per sister so then that created by an updated by will be updating so yeah that's it so we have enable the Jaypee auditing so we have provided like one auditor implementation class so with that implementation plans we are updating our created by and updated by values with Tom that's it so our our enable JP editing is done there so now what happens I'm going to pause it [Music] so now we so four methods for the ideal employee updating them plan and finally all the applies regulating gameplay so these are the four methods I'm going to [Music] response entity so now adding and fetching Ally implies is done that now our part is like to finally like the specific apply to find this Empire I'm going to find my ready is not I'm going to throw some eggs option so I'm going to generate this [Music] so I'm going to generate one exception guys okay so this exception will have a [Music] [Music] response status will have to do that's it so our exception is ready now so let me use here so so whatever that we have [Music] [Music] Oh okay so this mapping like so [Music] funny like so we have to delete them so [Music] [Music] yeah but sit down so these are the methods are available so that's it guys so the controller part is done so finally we need a properties so with that properties we will define like so this supposed to be this URL and so this is another continent main so this should match with your docker container name so this is for temper and our DB implied it and username and the password and show your scales on the console and ok so that's it guys so finally we need to cream is so I just put the path and compose Radford's will be how to define our services the one is for the spring boot application another one is with the post-race square so and so build path for this docker file and I have now put this 0 and so which will depends on the coarseness SQL DB so that is push this container so which will have question SMS ok which will run on five four three two five four three two so which will have an environment properties password username and Gabey so this implied maybe should match the way the application that were participating and this was this SQL DB okay this container name should match with your application force name okay otherwise it won't work guys in the talker so what I need to do is okay so I'm just skipping the next to saving that time so once it is built one two yes it will so it will get the two containers okay but John finally we should be so the dockerfile okay so this name was wrong guys that isn't a string there so so started so let me hit that Bank first of all like let me add you imply and see whether it is working or not so whether it's successfully inserted into or data so it should be inserted I did name and created and this is the body but how I and so just get mapping sorry the post mapping here see here we got one second so we got like created updated time what is system time and created bed updated by is Tom so that we have already in this class ok so here we have over at this time name right so that's what it's updated with this name and ID and name so let me check here see that here also so created it and updated it updated by incorrect by values also updated in this database ok so I think it's working guys so just so I have deleted this okay so let's check this whether it's deleted on man it's deleted successfully okay so it's working fine guys so I already attached to this project in true so the github you can get it from there okay so thanks thanks for watching this video so if you like this video so please do like and subscribe my channel thanks have a good day
Info
Channel: Techno Town Techie
Views: 37,483
Rating: undefined out of 5
Keywords: spring boot, PostgreSQL, docker, spring, java, docker compose, jpa, spring boot Postgresql jpa, spring boot PostgreSQL jpa hibernate, spring boot PostgreSQL crud example, spring boot postgresql connection, Kubernetes, spring boot with Kubernetes, spring boot with PostgreSQL, microservices, spring boot postgresql crud api, psql, spring boot postgresql maven, spring boot postgresql docker, spring boot postgresql Rest API, spring boot postgresql jpa hibernate restful crud api example
Id: hglfkhhBI14
Channel Id: undefined
Length: 28min 18sec (1698 seconds)
Published: Mon Jun 22 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.