Giter Site home page Giter Site logo

spring-lazy-eager-and-dynamic-loading's Introduction

Screenshot 2023-03-12 at 11 14 55 PM

https://www.imperva.com/learn/performance/lazy-loading/#:~:text=rendered%20or%20executed.-,Lazy%20Loading%20vs.,entities%20referenced%20by%20a%20resource

https://github.com/jeeftor/SpringBoot-Dynamic-JarLoad

https://medium.com/@Jeef/dynamically-loading-libraries-into-a-springboot-application-at-run-time-80639ee5aab

Spring boot lazy initialization was introduced at 2.2 version. 

Sometimes , we might need some of the beans to lazy initialize due to project requirements at the time of application start.


ApplicationContext and
BeanFactory by default lazy loads. It creates the beans only one time and loads when they are called via get method

ApplicationContext loads all the singleton beans upon the startup.

Screenshot 2023-03-12 at 11 46 21 PM

Screenshot 2023-03-12 at 11 48 05 PM

Screenshot 2023-03-12 at 11 49 44 PM

Screenshot 2023-03-12 at 11 52 14 PM

Screenshot 2023-03-12 at 11 53 41 PM

Product2 is eager initialization and Product1 is lazy initialization

2023-03-12T23:53:14.515+05:30  INFO 3726 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 637 ms
Product2 initialized
2023-03-12T23:53:14.612+05:30  INFO 3726 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2023-03-12T23:53:14.628+05:30  INFO 3726 --- [           main] com.sai.Lazy.LazyApplication             : Started LazyApplication in 1.069 seconds (process running for 1.51)
Product1 initialized
Product1 : mac
Product2 : ubuntu

spring-lazy-eager-and-dynamic-loading's People

Contributors

saiashish9 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.