Steps to develop spring Application
1) create
project folder structure
2) add required spring jar files.
3) write
Java business code inside src/main/Java
4) create beans configured Java/xml file
5) create
the test classes.
Note: to
avoid complexity of creating project folder structures and providing unique
build systems, encouraging better development practices, we are using build
tools.
Build
tools are Maven, Gradel, ant, etc..!.
Why spring is special?
Spring
is loosely-coupled framework.it is developed in modular fashion.
Spring Jars/libraries given as module wise, so we can use that required module only.
Spring
follows strategy design principles to archive loose-coupling.
Java Application can have multiple classes (service, controller, model, etc..!) and methods, as part of application execution one class method should talk to another class.
How one Java
class can talk to another Java class?
By inheriting the properties
By creating objects
If we
use above approach then our classes will be tightly coupled.
With the
help of Strategy design pattern principles, we can achieve loose coupling over classes.
Strategy
design pattern is a behavioral design pattern that enables selecting an
algorithm at runtime.
If we have multiple implementations for a task, we can choose one implementation dynamically.
Strategy design pattern principles are
1) favor's composition over inheritance.
2) always code to interfaces instead of implementation
classes.
3) code should be open for extension and should be closed
for modification.
No comments:
Post a Comment