Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Complex scope of a bean the issue and its resolution

  • Java from scratch
  • 2022-02-10
  • 27
Complex scope of a bean the issue and its resolution
  • ok logo

Скачать Complex scope of a bean the issue and its resolution бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Complex scope of a bean the issue and its resolution или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

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

Cкачать музыку Complex scope of a bean the issue and its resolution бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Complex scope of a bean the issue and its resolution

Complex scope of a bean the issue and its resolution:




====================================

Problem Statement:

We learn in College , and College has departments.
A college has multiple Departments. so each time Someone Requests for department, he should get
different department, this is our requirement.
but if you dont Configure it Properly, you will end up getting the same department every time.
How to resolve this problem will see it from Scratch


Problem:

What will happen your main Bean is SingleTon Bean
and your Dependent(i.e. Autowired ) beans are Prototype?


1) create a Bean called College-- By Default this will be SingleTon Bean
Prove it.
you will get all SingleTon instances for College


2) create a bean called Department - And make it as a Prototype : @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
Prove it.
You will get all Prototype instances for Department thats great , thats expected


3) now add Department as a dependency in College Bean
and generate Getters and setters
remove department 1 and department 2 from main class
just keep college 1 and college 2
and try to get department from college 1 and college 2 ,
here is the problem.
even if Department is Prototype Bean, You will see the same instance for College 1 - for Department 1
and same instance for College 2

We wanted Different Department each time but it is returning same Department
you understand problem right



4)if we want to get different Department every time, then we need to Configure Proxy.
which means, instead of directly giving Department, we will give a Proxy to the College
Proxy will make sure , College will get a new Department every time its requested.
you need to add additional attribute in @Scope annotation to Configure a Proxy
example: @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.TARGET_CLASS)

Комментарии

Информация по комментариям в разработке

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

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]