Features of Spring core Module:
- Gives BeanFactory container
- Base module for other Spring modules
- Allows to develop local logics and Stand alone applications
- Can not be used to develop web applications, distributes applications.
- Logics of Spring core module applications can be accessed only from local clients and can’t be accused from remote clients.
- If application allows only local clients to access application logic then that application is called local application. Such logic is called local logic.
- If application allows both local and remote clients to access application logic and provides location transparency for clients, then that application is called Distributed application and such logic is called distributed logic.
- Location transparency means if server application location is changed that will be recognized by client application dynamically without modifying code in client application.
- Spring core module applications are local applications. So they allow only local clients
- Spring JEE module can develop distributed applications. So that these applications can have with local and remote client.
Spring Bean Class
The java class on which spring container can
perform instantiation dependency injection and other life cycle operations is
called Spring Bean class. Any
pre-defined or user-defined or third party supplied concrete java class can be
configured as Spring Bean for Spring application. Spring Bean need not to be a
java bean. But Java Bean can also act as Spring Bean. Distributed applications
are client-server applications having location transparency. RMI, EJB, Spring
JEE module, web services etc are the distributed technologies to develop these
distributed applications.
Resources for developing Spring core module application
Spring Interface (It is a POJI) (Optional): Spring Interface is the common understanding document between Spring
client application developer, spring bean class developer containing
declaration of Business method. But it is optional in core module applications.
Because the spring Bean class and client application resides and execute from
the same JVM in core module applications
Spring Bean class (It is a POJO): Implements spring Interface (optional). Contains Bean properties
(member variables) to hold values injected through Dependency Injection.
Contains setter methods, constructors supporting Dependency Injection. Contains
user defined methods as life cycle methods (optional).Definitions of business
methods having business logic that are declared in Spring interface. Other
utility/helper methods (Optional).
Spring Configuration file (xml file): Any <filename>.xml can act as Spring configuration file and this
file name must be informed to spring container. There is no default name for
spring configuration file expected by Spring container when no file name is
specified explicitly. Contains Spring Bean classes’ configurations. Contains
Spring Bean properties configuration. Contains Dependency injection
configurations.
Client Application (Stand alone java
application): Must be local client Application. (Must reside
in the same JVM where Spring Bean class executes). Activates Spring container by
passing Spring Configuration file. Makes spring container performing dependency
injection on Spring Bean class properties. Gets access to Spring Bean class object
from Spring Container. Calls business methods on Spring Bean class object.
Note:
- Member variables declared in Spring Bean class are called Bean properties.
- A java bean class can act as Spring Bean class. But it is not mandatory that every spring bean class must be a java bean.
- In one spring application, we can see multiple Spring interfaces, Spring Bean classes. But all the Spring Bean classes must be configured in Spring configuration file.
- Creating, managing Spring Bean class object, calling life cycle methods, calling methods related to Dependency injection in Spring Bean class will be taken care by Spring container.
references:
Spring reference manual