Lesson1 - Intro To WAA - Spring Boot
Lesson1 - Intro To WAA - Spring Boot
servlet
Application
termination or
Servlet Container Garbage instantiation
shutdown calls collection Loaded [new()]
destroy() method & init’ed when FIRST
request is received [
or configured
to load on startup]
Destruction
initialization
Destroy()
Ready
Service()
Request is forwarded to
the Servlet’s service() method
Http Requests
Thread 1 Init()
web
container
Thread 2
/ service()
Web server
Servlet
container Thread 3
destroy()
servlet-mapping>
“url-pattern” is
<servlet-name>hello</servlet-name>
the way the
<url-pattern>/hello</url-pattern> servlet is
</servlet-mapping> specified in the
Browser.
Kiosk Industry
Standards
Enterprise Business Rule Engines
Profile Indicator Custom er Analytic/ Financial Plan M odeling Credit Sales/Pricing Credit Indicator
Loan Calculator
Services Decisioning (customer self-service or WF agents) Decisioning Configuration Services
Call Center Enterprise Integrated Information for Sales & Enterprise Integrated
Service Info. For Analysis
Enterprise Enterprise
Enterprise Customer Enterprise Enterprise
Customer Enterprise Enterprise Enterprise Enterprise
Voice Customer Customer Request Product Org/WF Enterprise
Info & Rel. Account Referral Sales/Deals Leads Data
Response Contact Status Catalog Rep Datamarts
Summary Warehouse
Teller
Industry
Standards
Cross-
Access and Industry Industry Contribute
Store
Usage of
Standards Business Standards PRODUCT/SERVICE SYSTEMS (internal, outsource & partnership/alliances) to/Use
Enterprise Inform ation of Analysis
Services and Agents Results
Information
Field Rep
Cross Business Infrastructure Services Common Distributed Infrastructure
Systems Mngmt
Execution Services (S/w , H /w ) Core Infrastructure Services
Data Services
Security
Capability Stage:
Direction – No Progress
Initial: limited strategic functionality; production pilots or single LOB/channel use
Expanded: increased strategic functionality; limited Enterprise Information populated and used by a few
LOBs/channels
Advanced: full strategic functionality; Enterprise Information populated by many LOBs; wide production use
Enterprise Shared, must Business Line options with Enterprise Standard - could be
Key: contribute & use integration requirements more than one product
Model 1 Architecture
Model 1 mixes view and business logic inside each handling servlet (or JSP). This makes it more difficult to
change the view independently of that logic, and difficult to change business logic without changing the
view.
Model 2 Architecture
Model II cleanly separates business data and logic from the view, and the two are
connected through a controller servlet. The model allows for multiple
controllers/servlets, [e.g., one per GET/POST pair].
Typical MVC Framework implementations have just one controller servlet which
centralizes common tasks.
Model 3 Architecture built in this course
Spring Spring
router components service http mvc data
Database
Spring
modules
.
Spring framework
Component web
oxm jms
web portlet
transactions
core container
Beans core Context SpEl
test
Inversion of Control
@Autowired
ProductService productService;
ProductService productService;
@Autowired
public void setProductService(ProductService productService){
this.productService = productService;
● Constructor based:
ProductService productService;
@Autowired
public ProductController(ProductService productService) {
this.productService = productService;
}
● JavaBean
○ Adhere to Sun’s JavaBeans specification.
○ Implements Serializable interface.
○ Must have default constructor, setters & getters.
○ Reusable Java classes for visual application composition.
● POJO
○ ‘Fancy’ way to describe ordinary Java Objects
○ Doesn’t require a framework
○ Doesn’t require an application server environment
○ Simpler, lightweight compared to ‘heavyweight’ EJBs
● Spring Bean
○ Spring managed - configured, instantiated and injected.
A Java object can be a JavaBean, a POJO and a Spring bean all at the
same time.
● The objects that form the backbone of your application and that
are managed by the Spring IoC container are called beans.
● A higher layer can use services in a lower layer, but not the
other way around
Service interfaces
Domain Service layer
Service
implementations
Repository Interfaces
Database
Stereotype annotations
component
controller
repository
service
Restcontroller
● The @Service marks a Java class that performs some service, such
as execute business logic, perform calculations and call external
APIs
Dispatcher servlet
Re
qu
se
es
on
t
sp
Re
ModelAndView
Controller
Response
Request
Request
Request
Request
View
Handler View
controller view
mapping resolver
● It provides a simpler and faster way to set up, configure, and run
both simple and web-based applications.
● With Embedded server, you can run a web application as a normal Java
application.
● Embedded server implies that our deployable unit contains the binaries for
the server (example, tomcat.jar).
● Spring Boot provides several “Starters” that let you add jars to your class
path.
● spring-boot-starter-parent
○ inherits dependency management from spring-boot-dependencies
○ Override property e.g., java.version
○ default configuration for plugins e.g. maven-jar-plugin
● Other starters
○ spring-boot-starter-web
○ spring-boot-starter-thymeleaf
○ spring-boot-starter-test