{"payload":{"feedbackUrl":"https://github.com/orgs/community/discussions/53140","repo":{"id":719027376,"defaultBranch":"main","name":"01-springboot-core-overview","ownerLogin":"SelfLearningFamily","currentUserCanPush":false,"isFork":false,"isEmpty":false,"createdAt":"2023-11-15T09:46:58.000Z","ownerAvatar":"https://avatars.githubusercontent.com/u/81168065?v=4","public":true,"private":false,"isOrgOwned":true},"refInfo":{"name":"","listCacheKey":"v0:1700041619.0","currentOid":""},"activityList":{"items":[{"before":"96e00b75b2c3830b667f87c1f09dd77a9c81f8bc","after":"dcdad4154bae0fac5bb24b234b944afeaa90e23c","ref":"refs/heads/main","pushedAt":"2023-11-22T20:31:50.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"zakiSiddiqui","name":"Zaki Siddiqui","path":"/zakiSiddiqui","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/75200014?s=80&v=4"},"commit":{"message":"Core Demo: Beans Vs Components\n\nBoth beans and Component annotation used for creating a spring bean class. Then question arises why we need 2 of them. though both of them provides us with the spring beans, but their usage differentiate it.\n\nSo far all the code that has been done in this project, we were using component annotation for creating the bean. But now lets imagine for a second that there is a class that you want use as a spring bean but its in 3rd party library. So now you can't add the use the component annotation because its in the 3rd party lib. To overall this situation, comes the bean annotation. It helps us to use those classes as bean which are not originally part of your project or don't have access to edit them and add component annotation. So to add this class in your spring create a class with configuration annotation. example SportConfig. and create a method to instantiate the object of the class you want to include in your spring project. and thats it. this class is now part of your spring project.\n\n this is the main difference. Other than that, bean annotation use at method while component annotation use at class.","shortMessageHtmlLink":"Core Demo: Beans Vs Components"}},{"before":"4c9d13d697786c6cdf152cf34315f0c05e1c9fa2","after":"96e00b75b2c3830b667f87c1f09dd77a9c81f8bc","ref":"refs/heads/main","pushedAt":"2023-11-22T19:41:57.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"zakiSiddiqui","name":"Zaki Siddiqui","path":"/zakiSiddiqui","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/75200014?s=80&v=4"},"commit":{"message":"Bean post construct and pre destroy\n\nBean has a complete lifecycle through it goes trough the different phases and generate different callbacks. Among those, the most important ones are post construct and pre-destroy callback\n\nSpring container started -> beans instantiated -> inject dependencies -> internal spring processing -> post construct methods -> \"bean ready\" ->\ncontainer is shutdown -> pre-destroy callback -> bean destroyed.\n\nNote: When bean scope is set to prototype, then pre-destroy method don't call. neither those beans get destroyed automatically. one must handle in at client side code","shortMessageHtmlLink":"Bean post construct and pre destroy"}},{"before":"69e6b62f7ae67109897fca27b99558aef3246fbe","after":"4c9d13d697786c6cdf152cf34315f0c05e1c9fa2","ref":"refs/heads/main","pushedAt":"2023-11-16T22:45:41.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"zakiSiddiqui","name":"Zaki Siddiqui","path":"/zakiSiddiqui","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/75200014?s=80&v=4"},"commit":{"message":"Bean Scopes singleton vs prototype\n\nBean Scopes:\n\nthere are mainly two scopes on beans i.e singleton and prototype. there are scopes like request, session global session. But they are only useful for web apps.\n\nBy default bean scope is singleton. Means (a little recap of singleton) there would only one instance per bean. Example. In DemoController there is a request named check. It check if the two objects defined in demoController refer to the same bean or not. So when you ll run the application, and hit the check request, it will show u 'true' because default scope is singleton.\n\nPrototype:\nIn prototype scope, a new bean is initialized for every request. Example: To see this in action, uncomment the Scope the line in CricketCoach, and re run the application and hit check url. you ll see now it will return the false value which means now mycoach and anotherCoach are separate beans","shortMessageHtmlLink":"Bean Scopes singleton vs prototype"}},{"before":"8bcbba2d7c241ea10fb5a80e84988def141d8881","after":"69e6b62f7ae67109897fca27b99558aef3246fbe","ref":"refs/heads/main","pushedAt":"2023-11-16T21:40:37.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"zakiSiddiqui","name":"Zaki Siddiqui","path":"/zakiSiddiqui","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/75200014?s=80&v=4"},"commit":{"message":"Lazy initialization: local plus global\n\nHere explaining the concept of lazy:\n\ndefinition:\nby default all the beans are created on the initialization. If we mark a Class with lazy annotation. then that bean would only be created when it is being call. In other words, it will be created when needed.\n\nuseful points:\n1) Even if a class is marked as primary, but if u mentioned the lazy annotation, it would still act as normal lazy class (only created when needed). Example: TrackCoach is primary as well as lazy.\n\n2)bean marked as lazy would only be created upon get called. Example: CricketCoach.\n\n3) even its lazy, but it would still created only one time as standard bean in spring.\n\n4) for making every bean and controller lazy, add the property in application.properties class (as in the commit).\n\n5) even controller get created upon first call. u won't see anything upon starting the application.","shortMessageHtmlLink":"Lazy initialization: local plus global"}},{"before":"cfb51fecc85835eca4ec4d1344932d6c9ad9c5c8","after":"8bcbba2d7c241ea10fb5a80e84988def141d8881","ref":"refs/heads/main","pushedAt":"2023-11-15T10:04:23.000Z","pushType":"push","commitsCount":1,"pusher":{"login":"zakiSiddiqui","name":"Zaki Siddiqui","path":"/zakiSiddiqui","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/75200014?s=80&v=4"},"commit":{"message":"spring core demo- till primary","shortMessageHtmlLink":"spring core demo- till primary"}},{"before":null,"after":"cfb51fecc85835eca4ec4d1344932d6c9ad9c5c8","ref":"refs/heads/main","pushedAt":"2023-11-15T09:46:59.000Z","pushType":"branch_creation","commitsCount":0,"pusher":{"login":"zakiSiddiqui","name":"Zaki Siddiqui","path":"/zakiSiddiqui","primaryAvatarUrl":"https://avatars.githubusercontent.com/u/75200014?s=80&v=4"},"commit":{"message":"Initial commit","shortMessageHtmlLink":"Initial commit"}}],"hasNextPage":false,"hasPreviousPage":false,"activityType":"all","actor":null,"timePeriod":"all","sort":"DESC","perPage":30,"cursor":"djE6ks8AAAADtZAZLAA","startCursor":null,"endCursor":null}},"title":"Activity ยท SelfLearningFamily/01-springboot-core-overview"}