1. Pros and Cons about Sping
Cons:
Huge, I wouldn't put 3000 jars in my hobby project
Slower than other DI, like juice
getting more and more complex in annotation and XML
Pros:
decoupling
readable
2. What are the common types of Dependency Injection:
Constructor-based:
Use for mandatory injection
Setter-based:
invoking a no-argument constructor or no-argument static factory method to instantiate your bean.
Use for optional injection
1. Inject differently
2. Constructor guarantees injection while setter injection can be failed
3. Setter injection can detect circular dependency by throwing ObjectCurrentlyInCreationException
http://javarevisited.blogspot.com/2012/11/difference-between-setter-injection-vs-constructor-injection-spring-framework.html
3. What is the scope of Java Spring bean?
singleton: one object/ container prototype/request: one object/ bean is requested or HTTP requested
No comments:
Post a Comment