https://github.com/baratharivazhagan/spring-programmatically-register-beans
https://github.com/baratharivazhagan/spring-programmatically-register-beans
spring spring-boot
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/baratharivazhagan/spring-programmatically-register-beans
- Owner: BarathArivazhagan
- Created: 2017-12-24T18:22:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-24T18:39:39.000Z (over 8 years ago)
- Last Synced: 2025-07-04T22:42:19.712Z (12 months ago)
- Topics: spring, spring-boot
- Language: Shell
- Size: 49.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# spring-programmatically-register-beans
Spring boot application demonstrates how to use Configurable Application context to register beans programmatically.
### How to register a bean programmatically in spring application context ?
```
ConfigurableApplicationContext applicationContext=SpringApplication.run(Application.class, args);
ConfigurableBeanFactory beanFactory=applicationContext.getBeanFactory();
beanFactory.registerSingleton("testBean", new Object());
```