Welcome To The Spring Session: Lean Software Development Practice Series
Welcome To The Spring Session: Lean Software Development Practice Series
Chiradip
• What?
• Why?
• How? (intention)
• With what? (composition)
J2EE (Now JEE)
Frameworks
• What is IoC?
• Dependency Injection
• “Plugin pattern” - special mention
IoC Fundamentals (contd...)
✤ Different types of DI
✴ Constructor injection
✴ Setter Injection
✴ Interface Injection
AOP Fundamentals
✤ Cross-cutting concern
database trigger would apply.
A package of functionality providing the cross-cutting
requirements. A set of
triggers for auditing database access would be analogous to an
✤ Point-cut
AOP aspect for auditing.
✤ Aspect
✤ Advice
Lets write our first
Spring-AOP App...
✤ JDBC
✤ Hibernate
✤ Oracle TopLink
Spring & ORM
✤ DAO
Spring & ORM
✤ Helper Classes
Spring MVC
• What is MVC?
• How Spring supports it?
Spring MVC (contd.)
Request Response
✤ Components
✤ Dispatcher - the entry point of the Spring
MVC is a servlet -
org.springframework.web.servlet.Dispatch
erServlet
<servlet><servlet-name>timetracker</servlet-name>
<servlet-class> org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:timetracker-servlet.xml</param-value>
</init-param>
</servlet>
Spring MVC (contd.)
timetracker-servlet.xml
<servlet-mapping>
<servlet-name>timetracker</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
Spring MVC (contd.)
Mappings
✤ Mappings
......
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<map>
</map>
</property>
</bean>
Spring MVC (contd.)
✤ Controller
✤ controller is the core of the presentation logic for Spring MVC.
Once DispatcherServlet gets the GET request it chooses one suitable
controller from the Mapping.
"org.springframework.web.servlet.mvc.ParameterizableViewController">
</bean>
Spring MVC (contd.)
✤ Controller
✤ We have SimpleFromController as well. It can be overridden to do
the following things:
• Assign (and type-convert) incoming request parameters to attributes of a command object representing the form to be rendered.
(This is known as binding the request parameters to the command object.)
• Populate the request with error objects representing the points of failure in validation.
✤ Validation (form)
✤ Exception Handling
Spring MVC (contd.)
<start-state idref="createUser"/>
</view-state>
</view-state>