SlideShare a Scribd company logo
Spring Introduction
Tác giả 
• Rob Johnson 
• Based on his book : Expert One-on-One J2EE 
Design
What’s Spring 
• Java Application Framework 
• Spring core build on Dependency Injection 
Pattern 
• Many modules
Spring Introduction
Dependency Injection 
• A class should not configure its dependencies 
statically but should be configured from 
outside 
• If a class directly creates an instace of anohter 
class via the new operator, it cannot be used 
(and tested) independently
Problem 
class DAOUser{ 
private DataSource dataSource 
private DAOUser(){ 
dataSource = new MySQLDataSource(); 
datsSource.set(..some..properties); 
} 
} 
DAOUser MySQLDataSource
Constructor Injection 
class DAOUser{ 
private DataSource dataSource 
private DAOUser(DataSource dataSource){ 
this.dataSource = dataSource 
} 
} 
Easier to test 
DAOUser DataSource
Injection 
class DAOUser{ 
private DataSource dataSource 
private DAOUser(DataSource dataSource){ 
this.dataSource = dataSource 
} 
} 
OR 
class DAOUser{ 
private DataSource dataSource 
private void setDataSource(DataSource dataSource){ 
this.dataSource = dataSource 
} 
} 
DAOUser DataSource
Injector  
class DAOInjector{ 
public void inject(){ 
DataSource dataSource = new DataSource(); 
DAOUser daoUser = new DAOUser(dataSource); 
} 
} 
DAOUser DataSource 
DAOInjector
Injector in Spring 
class DAOUser{ 
@Autowired 
private DataSource dataSource; 
//setter for dataSource 
... 
} 
@Component 
class MySQLDataSource extends DataSource{ 
}
Demo
SPRING WEBSERVICE
Spring webservice
Spring Security
Demo

More Related Content

PDF
2nd-Order-SQLi-Josh
PDF
Persistent Session Storage
PPT
Jdbc
PDF
Web Application Security 101 - 14 Data Validation
PDF
Flask restless
DOCX
Oracle ebs how to obtain environment variable value using sql query
PPTX
Rapid java application development @ JUG.ru 25.02.2012
PPTX
Deserialization vulnerabilities
2nd-Order-SQLi-Josh
Persistent Session Storage
Jdbc
Web Application Security 101 - 14 Data Validation
Flask restless
Oracle ebs how to obtain environment variable value using sql query
Rapid java application development @ JUG.ru 25.02.2012
Deserialization vulnerabilities

What's hot (16)

PPTX
SQL Injection Defense in Python
PDF
Sql injection 幼幼班
PPTX
Observer & singleton pattern
DOCX
Android database tutorial
PPT
SQL Injection
PDF
CDI 2.0 Deep Dive
PDF
20150210 solr introdution
PDF
Multithreading on iOS
PDF
SQL Injection: complete walkthrough (not only) for PHP developers
PPTX
Core Data Performance Guide Line
PPTX
Sql killedserver
PDF
How to identify and prevent SQL injection
PPT
Asegúr@IT IV - Remote File Downloading
PDF
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
PDF
Solr Security: Tips and Tricks and Things You Really Ought to Know - Kevin Co...
SQL Injection Defense in Python
Sql injection 幼幼班
Observer & singleton pattern
Android database tutorial
SQL Injection
CDI 2.0 Deep Dive
20150210 solr introdution
Multithreading on iOS
SQL Injection: complete walkthrough (not only) for PHP developers
Core Data Performance Guide Line
Sql killedserver
How to identify and prevent SQL injection
Asegúr@IT IV - Remote File Downloading
SQL Injection 101 : It is not just about ' or '1'='1 - Pichaya Morimoto
Solr Security: Tips and Tricks and Things You Really Ought to Know - Kevin Co...
Ad

Similar to Spring Introduction (20)

PPT
Hybernat and structs, spring classes in mumbai
PPTX
Skillwise-Spring framework 1
PPTX
Spring jdbc dao
PPT
Spring - a framework written by developers
PPT
Spring introduction
PPTX
Spring (1)
PPTX
Spring framework in depth
PPT
PDF
Spring framework Introduction
PPT
Spring framework
PPTX
Spring framework
PDF
Spring 2
PPTX
Spring IOC and DAO
PPT
Spring Intro
PDF
Toms introtospring mvc
PPTX
Spring framework part 2
PPTX
Spring
PPT
Spring talk111204
PDF
summarizer12Abr16_Spring
PDF
The Basic Concept Of IOC
Hybernat and structs, spring classes in mumbai
Skillwise-Spring framework 1
Spring jdbc dao
Spring - a framework written by developers
Spring introduction
Spring (1)
Spring framework in depth
Spring framework Introduction
Spring framework
Spring framework
Spring 2
Spring IOC and DAO
Spring Intro
Toms introtospring mvc
Spring framework part 2
Spring
Spring talk111204
summarizer12Abr16_Spring
The Basic Concept Of IOC
Ad

Recently uploaded (20)

PPTX
Oracle Fusion HCM Cloud Demo for Beginners
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
Designing Intelligence for the Shop Floor.pdf
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Nekopoi APK 2025 free lastest update
PPTX
assetexplorer- product-overview - presentation
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Website Design Services for Small Businesses.pdf
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Cost to Outsource Software Development in 2025
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
Oracle Fusion HCM Cloud Demo for Beginners
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
17 Powerful Integrations Your Next-Gen MLM Software Needs
Designing Intelligence for the Shop Floor.pdf
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Nekopoi APK 2025 free lastest update
assetexplorer- product-overview - presentation
Odoo Companies in India – Driving Business Transformation.pdf
Operating system designcfffgfgggggggvggggggggg
Website Design Services for Small Businesses.pdf
Weekly report ppt - harsh dattuprasad patel.pptx
Cost to Outsource Software Development in 2025
wealthsignaloriginal-com-DS-text-... (1).pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Design an Analysis of Algorithms I-SECS-1021-03
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Advanced SystemCare Ultimate Crack + Portable (2025)

Spring Introduction

  • 2. Tác giả • Rob Johnson • Based on his book : Expert One-on-One J2EE Design
  • 3. What’s Spring • Java Application Framework • Spring core build on Dependency Injection Pattern • Many modules
  • 5. Dependency Injection • A class should not configure its dependencies statically but should be configured from outside • If a class directly creates an instace of anohter class via the new operator, it cannot be used (and tested) independently
  • 6. Problem class DAOUser{ private DataSource dataSource private DAOUser(){ dataSource = new MySQLDataSource(); datsSource.set(..some..properties); } } DAOUser MySQLDataSource
  • 7. Constructor Injection class DAOUser{ private DataSource dataSource private DAOUser(DataSource dataSource){ this.dataSource = dataSource } } Easier to test DAOUser DataSource
  • 8. Injection class DAOUser{ private DataSource dataSource private DAOUser(DataSource dataSource){ this.dataSource = dataSource } } OR class DAOUser{ private DataSource dataSource private void setDataSource(DataSource dataSource){ this.dataSource = dataSource } } DAOUser DataSource
  • 9. Injector  class DAOInjector{ public void inject(){ DataSource dataSource = new DataSource(); DAOUser daoUser = new DAOUser(dataSource); } } DAOUser DataSource DAOInjector
  • 10. Injector in Spring class DAOUser{ @Autowired private DataSource dataSource; //setter for dataSource ... } @Component class MySQLDataSource extends DataSource{ }
  • 11. Demo
  • 15. Demo