https://github.com/kh77/springboot-prototypeinjection
3 ways to call prototype class within Singleton class
https://github.com/kh77/springboot-prototypeinjection
java spring-boot spring-injection
Last synced: about 2 months ago
JSON representation
3 ways to call prototype class within Singleton class
- Host: GitHub
- URL: https://github.com/kh77/springboot-prototypeinjection
- Owner: kh77
- Created: 2022-08-20T20:58:39.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-08-20T20:58:51.000Z (almost 4 years ago)
- Last Synced: 2025-07-01T01:41:52.487Z (12 months ago)
- Topics: java, spring-boot, spring-injection
- Language: Java
- Homepage:
- Size: 14.7 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot - Prototype injection
We have a scenario to get the prototype bean from singleton
class but when we get the prototype bean then it will be
treated as a singleton because it is injected in
another singleton class. To solve this problem
- ApplicationContext
- ObjectFactory
- LookUp (Best way) : @Lookup tells Spring to return an
instance of the method's return type when we invoke it.