Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Spring | Injecting a Prototype bean in a Singleton Bean | Problem and Solution | Simple Programming

Автор: Simple Programming

Загружено: 2020-06-08

Просмотров: 31118

Описание:

In this video, let us discuss a very common interview question nowadays.
What happens when you inject a prototype bean inside a singleton bean?

Now if you ask question like can you tell me about the different scopes in spring, everyone will tell singleton, prototype, request, session, application, websocket etc and thy will even given definitions of these scope

but you slightly tweak the question and ask them what exactly happens when you have that scenario… And being an interviewer myself, 9 in 10 candidates will not give the right answer. In some cases if the candidate is able to tell guess the answer, they will not be able to give a solution to the problem.

alright, so we all know the default scope in spring in singleton. that is the container creates a single instance of that bean, and for any number of requests spring is going to give the same object, which is actually cached in the container.

and what is prototype - every time it is requested, a different instance is returned from the container.

so what exactly happens when you inject two different scopes together. i.e prototype into singleton

both beans will be initialized only once, at the startup.. prototype will loose its actual behavioral property.

lets take a look at this using an example and what we will do also address this problem using different methodologies.

We will be fixing this problem with,
1. ApplicationContext
2. Method Injection (@Lookup)
3. Provider (JSR component)
4. ObjectFactory

#prototype #singleton #springboot

Spring | Injecting a Prototype bean in a Singleton Bean | Problem and Solution | Simple Programming

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Spring Boot - @Autowired, @Qualifier, @Primary, @Required | Simple Programming

Spring Boot - @Autowired, @Qualifier, @Primary, @Required | Simple Programming

Синьор 1С: 10 привычек, без которых ты не вырастешь

Синьор 1С: 10 привычек, без которых ты не вырастешь

Mastering Spring Bean Scopes: Practical Guide to Singleton, Prototype & More!

Mastering Spring Bean Scopes: Practical Guide to Singleton, Prototype & More!

Spring Boot | Microservices Interview Questions - PART 2 | Simple Programming

Spring Boot | Microservices Interview Questions - PART 2 | Simple Programming

Я в опасности

Я в опасности

Master Microservices Strangler Pattern by Top AWS Experts

Master Microservices Strangler Pattern by Top AWS Experts

Kubernetes — Простым Языком на Понятном Примере

Kubernetes — Простым Языком на Понятном Примере

Музыка лечит сердце и сосуды🌸 Успокаивающая музыка восстанавливает нервную систему,расслабляющая

Музыка лечит сердце и сосуды🌸 Успокаивающая музыка восстанавливает нервную систему,расслабляющая

Spring Boot - Caching Data - Introduction | Part 1 | Simple Programming

Spring Boot - Caching Data - Introduction | Part 1 | Simple Programming

Inject Prototype Into Singleton Bean Spring (Look Up Method Injection) Spring Beans 2017

Inject Prototype Into Singleton Bean Spring (Look Up Method Injection) Spring Beans 2017

Spring Boot - Caching Data - EhCache | CacheManager | Part 2 | Simple Programming

Spring Boot - Caching Data - EhCache | CacheManager | Part 2 | Simple Programming

Евгений Борисов — Spring-потрошитель, часть 1

Евгений Борисов — Spring-потрошитель, часть 1

Java 8 Streams | map() and reduce()  Example | JavaTechie

Java 8 Streams | map() and reduce() Example | JavaTechie

The Windows 11 Disaster That's Killing Microsoft

The Windows 11 Disaster That's Killing Microsoft

Red Smoke — Deep House Chill Mix 2026 | Night Vibes

Red Smoke — Deep House Chill Mix 2026 | Night Vibes

"please stop calling us slop" - Microslop

Spring Tutorial 11 — Понимание областей действия компонентов

Spring Tutorial 11 — Понимание областей действия компонентов

Spring profiles explained -  Microservice configuration with Spring Boot [08]

Spring profiles explained - Microservice configuration with Spring Boot [08]

Кто пишет код лучше всех? Сравнил GPT‑5.2, Opus 4.5, Sonnet 4.5, Gemini 3, Qwen 3 Max, Kimi, GLM

Кто пишет код лучше всех? Сравнил GPT‑5.2, Opus 4.5, Sonnet 4.5, Gemini 3, Qwen 3 Max, Kimi, GLM

Spring ultimate basics: What are Spring Beans and what is the Spring Container?

Spring ultimate basics: What are Spring Beans and what is the Spring Container?

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com