My tryout to create simplified version of Spring Framework core for educational purposes.
I was inspired by this article.
- Classpath scanning for components
- Multi-staged constructor for components
- Field or setter based dependency injection
- Aware callbacks:
BeanNameAware
,BeanFactoryAware
- Bean post processors support, with post processing before and after initialization
- Javax bean lifecycle annotations support:
@PostConstruct
,@PreDestroy
InitializingBean
andDisposableBean
callbacks- Application event listening
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
The project has no dependencies, it uses only pure java, you don't need to preinstall anything except java.
✗ java -version
openjdk version "11.0.1" 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)
Clone the project and open in your favourite IDE.
End with an example of getting some data out of the system or using it for a little demo
Just run Main.java to test framework functionality. Several services created fot testing purposes:
- ServiceBean.java which is managed by container and implements BeanNameAware.java callback. Also he demonstrates the setter-based injection
- AnotherServiceBean.java which is managed by container and implements two callbacks - InitializingBean.java and ApplicationEventListener.java. Also he has property-based injection.
- FirstRepositoryBean.java
which is managed by container and implements BeanFactoryAware.java
callback and
@PostConstruct
lifecycle callback
These testing classes are designed to demonstrate all features and provide following console output:
==Initializing bean factory==
==Populating bean properties==
@PostConstruct is called in AnotherServiceBean
com.github.vlsidlyarevich.test.ServiceBean@5b275dab is set
AnotherServiceBean is called
serviceBean is called
FirstRepositoryBean is called
com.github.vlsidlyarevich.winterframework.beans.factory.SimpleBeanFactory@61832929 is here
Context is closed
Framework supports following bean lifecycle:
This project is just my research based on this article. No any specific rules of contribution needed.
Vladislav Sidlyarevich - Github profile
This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details