SlideShare uma empresa Scribd logo
1 de 40
Julien Dubois
Developing modular Java   France Regional Director
      applications        SpringSource
Julien Dubois
• France Regional Director, SpringSource

• Book author :« Spring par la pratique » (Eyrolles, 2006) – new
  edition coming soon!

• 10 years of experience in Java development

• Member of OSSGTP
Why do we want modular
applications in the first place?
• Dividing a complex problem into simpler, more manageable
  problems is a well-known technique since 400 years
  (Descartes)

  • Improved quality

  • Lower complexity

• Modules are easy to reuse across an application or even
  several applications

  • Improved time-to-market

  • Lower costs

• Only true for “enterprise-grade” applications
Agenda


• Modules, layers and errors



• Doing a layered Spring application the easy way



• Modular Java with Spring and OSGi



• Modularity in the cloud
Agenda


• Modules, layers and errors



• Doing a layered Spring application the easy way



• Modular Java with Spring and OSGi



• Modularity in the cloud
Modularity & layers
• Typical Java applications are separated in layers

Presentation               Service                Repository
   Layer                    Layer                   Layer

     Object                  Object                   Object



     Object                  Object                   Object



     Object                  Object                   Object
Modularity is more than layers
• 1 module = 1 layer is the simplest solution

  • Good enough for smaller projects

• Modules can be horizontal and vertical

  • Modules per layer : as seen in the previous slide

  • Modules per functionality : admin module, accounting module
                                       Service          Repository
     Admin module
                                        Layer             Layer




   Accounting module
Errors
• Many architects want those layers to be well-separated

  • They separate those layers physically – “let’s do EJB 1 again!”
           Server A                             Server B


                             Remoting




• As seen in the biggest French IT consulting firms, banks,
  telecom companies, healthcare companies, etc… during the last
  decade.

• This essentially comes from poorly-designed specs (EJBs)
  written by hardware vendors…
What is the problem?
• Adding more servers will never make your application more
  scalable

• Remoting is slow and inefficient

  • A remoting call is several orders of magnitude slower than a
    local one

  • Remoting also affects your GC time : all those remote objects are
    being garbage collected…

  • Adding more servers will just add more network issues

• You do not need to physically separate your modules to have a
  modular application
Agenda


• Modules, layers and errors



• Doing a layered Spring application the easy way



• Modular Java with Spring and OSGi



• Modularity in the cloud
Spring & Layers
• Let’s do this architecture with local Spring beans

Presentation              Service               Repository
   Layer                   Layer                  Layer

    Object                  Object                     Object



    Object                  Object                     Object



    Object                  Object                     Object
Separating layers with Spring
• The good news : with Spring, it works out of the box!

• Spring even has some specific Java annotations for this :

  • @Controller for a Spring MVC controller (presentation layer)

  • @Service for a Spring business bean (service layer)

  • @Repository for a Spring repository bean (repository layer)

• There are many other ways to do this with Spring

  • Using naming conventions with component scanning

  • Using Spring’s XML configuration file
Layered Spring application
• A layered Spring application

Presentation              Service      Repository
   Layer                   Layer         Layer

 @Controller                @Service   @Repository



 @Controller                @Service   @Repository



 @Controller                @Service   @Repository
Show me the code!
package myapplication.service;     This Spring Bean belongs
                                      to the Service layer
@Service
public class AccountServiceImpl implements
AccountService {
                                   Injecting a Spring bean
                                  from the Repository layer
     @Autowired
     private AccountRepository accountRepo;
     @Transactional
     @Secured("ROLE_MANAGER")
     public void addAccount(String login) {
       Account account = new Account(login);
       account.setPassword(“changeme”);
       accountRepo.save(account);
     }
 }
Spring’s hierarchical application contexts
• Spring also provides a hierarchy of application contexts out of
  the box. By default (no specific configuration to do) :

  • There is a “root” application context, which contains the
    repository and service layers

  • The presentation layer (Spring @MVC) is a child of this root
    context :

    • @Controller beans see @Service beans, but not the opposite

  • Web Services written with Spring WS also have their own child
    application context
Default Spring configuration

@MVC Application   Root Application Context
   Context
                                @Repository
    @Controller     @Service


                                @Repository
 WS Application
                    @Service
   Context
                                @Repository
    @Endpoint
Separating layers with Spring
• The code we have seen is :

  • Easy to code and test

  • Very performant in production

  • Still well-separated in layers

• This is Spring default’s configuration

  • Works out of the box

  • This can be customized in many, many different ways

• You do not need to physically separate your layers to
  have a layered application
Agenda


• Modules, layers and errors



• Doing a layered Spring application the easy way



• Modular Java with Spring and OSGi



• Modularity in the cloud
The problem with the previous slides
• However, what we have just done is a monolithic application

  • Everything is put into a single deployment unit (a WAR file)

  • Memory is shared between all modules : not secured

• What you want as a developer is :

  • Updating your application at runtime, and not redeploy your WAR
    file all the time

• What your users want is :

  • New functionalities hot deployed at runtime

  • High availability

• But how can we change modules at runtime??
Introducing OSGi
• OSGi is a specification

  • Used since many years in the telecom industry

  • With several implementations in Java : for instance Equinox,
    which is the basis of the Eclipse IDE
It's a module system
• Partition a system into a number of modules – "bundles"

  • Each bundle has its own memory space    Presentation module
                                                Version 1.0

                                              @Controller
• Strict visibility rules
                                              Service module
                                               Version 1.0

• Resolution process                           @Service

  • satisfies dependencies of a module
                                             Repository module
                                                Version 2.0

                                             @Repository
• Understands versioning
It's dynamic
• Modules can be

  • installed
                   Service module
                    Version 1.0
  • started
                    @Service
  • stopped

  • uninstalled

  • updated
                   Service module
                    Version 2.0

                    @Service
• ...at runtime
It's even service-oriented
• Bundles can publish services

  • dynamically



• Service Registry allows other bundles to find services

  • and to bind to them



• Services come and go at runtime, all taken care of for you
Introducing Spring Dynamic Modules
• Doing OSGi directly is complex

  • It also makes your code dependant on the OSGi APIs

• Spring Dynamic Modules is a Spring project, backed by
  SpringSource

  • No OSGi in your code

  • Your Spring beans are just configured to be OSGi services

  • It’s easy to move a project to/from OSGi

    • Moving from Spring to Spring+OSGi is easy

    • Going back from Spring+OSGi to Spring is also easy
Introducing Spring Dynamic Modules
  • Configuring Spring beans

     • Just put your Spring configuration       Best Practice
       files in /META-INF/spring
                                                Separate your
     • It’s easy to export a Spring Bean to     business code
       the OSGi registry                          from your
                                                infrastructure
     • It’s easy to inject a Spring Bean from        code!
       another bundle
<beans ...>

 <bean id="customerDAO" class="dao.CustomerDAO"/>

 <osgi:service ref="customerDAO" interface="dao.ICustomerDAO"/>

 <osgi:reference id="dataSource" interface="javax.sql.DataSource"/>

</beans>
Who supports OSGi?
• Most application server vendors base their systems on OSGi




• Validates the usage of OSGi as a solution for modular
  applications

• But none offers OSGi as a programming model for the customer

• Why shouldn't the customer be as empowered as the
  application server vendor?
Enter SpringSource dm Server
• The short version : it’s Spring, Tomcat and OSGi working all
  together

  • Allows powerful and modular applications




                +                     +
dm Server empowers you to use OSGi
• dm Server allows you to use OSGi-based applications, running
  in an application server :

      Spring MVC            Spring Framework    Database Connection
                                                       Pool




                                   Service           Repository
     Admin module
                                   module             module




   Accounting module
Features for developers
• For developers :

  • A truly modular architecture : secured modules, with a well-
    defined lifecycle

  • More productivity                             Spring Framework
                                                                        Database
    thanks to the                Spring MVC                          Connection Pool
    hot-deployment of
    modules during
    development time :
    you only work on your       Admin module

    module, not on the                                    Service          Repository
                                                                            module
    whole application                                     module


                              Accounting module
Features for production
• For the production team :

  • Hot deployment of modules of the application at runtime :
    lower downtime
                                            Spring Framework
  • Several versions of                                           Database
                                                               Connection Pool
    the same module
    can be deployed in
    parallel
                                              Service
                                              module
  • Better usage of the                     Version 1.0
                                                                     Repository

    server resources :          Service
                                                                      module

    dm Server only loads        module
    modules that are          Version 2.0
    actually needed!
dm Server summary
• dm Server is the only application
  server that gives the power of
  OSGi to development and
  production teams

• dm Server is built on standard,
  widely used, Open Source
  components : Spring, Tomcat,
  Equinox

• Of course, dm Server is free
  software (GPL v3), so why don’t
  you start writing applications with
  it?
Agenda


• Modules, layers and errors



• Doing a layered Spring application the easy way



• Modular Java with Spring and OSGi



• Modularity in the cloud
Clustering
• The idea is to separate the load on several identical nodes

                       Apache httpd




dm Server              dm Server               dm Server




                                                            Module
Cloud computing & virtualization


• Experience shows that
  clusters are often widely
  under-utilized… Because
  you don’t need all the nodes
  all the time.



• Cloud computing allows renting computing power on demand

  • You can rent servers per hour with : Amazon EC2, Google
    AppEngine, Gandi Flex (in France)…

• Companies datacenters are moving to virtualization for this
  same reason
dm Server in the cloud
• Virtualization solution : SpringSource
  works with VMWare to provide new tools
  and support for dm Server in a
  virtualized environment

• IaaS (Infrastructure As A Service)
  solution : Amazon EC2 & Gandi Flex just
  provide the hardware… dm Server
  already runs on those systems

• PaaS (Platform As A Service) solution :
  No OSGi support on those solutions, but
  there is Groovy and Grails support on
  Google AppEngine (in cooperation with
  Google)
Cost reduction is king
• This can be far less expensive
  than a traditional cluster as long
  as :

  • You can monitor your load
    properly

  • You can estimate your needs in
    advance (launching a new EC2
    instance can take a few minutes)



• But with the current global economic climate, there is a very
  strong move towards those solutions
Hyperic
• SpringSource has just bought Hyperic (May 2009)

  • Hyperic is a leader
    in management
    and montoring

  • Hyperic already
    proposes
    CloudStatus, that
    monitors Amazon
    EC2 and Google
    AppEngine
Dynamic provisionning
• Currently our monitoring & management tools are able to :

  • Manage a group of servers : for example, deploying an
    application on 100 dm Server nodes with one click

  • Monitor a large group of nodes, including on the cloud or in a
    virtualized environment




• In the future, those tools will evolve to be able
  to do “provisionning”: dynamically adjust the
  number of running nodes depending on the load
Summary
• Complex applications should be split into modules : reduced
  cost, improved time-to-market

• If you want to split your application into modules at build
  time, Spring provides an excellent solution out of the box:
  there’s no need to go for more complex (and inferior) solutions
  Use tc Server (= enterprise version of Tomcat) and Spring

• If you want secured, well-defined modules that can be
  dynamically updated at runtime, Spring and OSGi offer a
  perfect solution

  Use dm Server (Tomcat + OSGi) and Spring

• Be ready for the future : cloud computing offers un-beatable
  scalability and costs. Both tc Server and dm Server are ready!
Questions?



Julien Dubois
julien.dubois@springsource.com

http://www.springsource.com/fr

Mais conteúdo relacionado

Mais procurados

Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkMohit Belwal
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework tola99
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014Ryan Cuprak
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the HorizonJosh Juneau
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Bruno Borges
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Hitesh-Java
 
Spring framework
Spring frameworkSpring framework
Spring frameworkAircon Chen
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 UpdateRyan Cuprak
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJosh Juneau
 
Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009kensipe
 
Advance java Online Training in Hyderabad
Advance java Online Training in HyderabadAdvance java Online Training in Hyderabad
Advance java Online Training in HyderabadUgs8008
 
108 advancedjava
108 advancedjava108 advancedjava
108 advancedjavaAnil Kumar
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkHùng Nguyễn Huy
 
Spring Mvc,Java, Spring
Spring Mvc,Java, SpringSpring Mvc,Java, Spring
Spring Mvc,Java, Springifnu bima
 

Mais procurados (19)

Java 9 and Project Jigsaw
Java 9 and Project JigsawJava 9 and Project Jigsaw
Java 9 and Project Jigsaw
 
JVMs in Containers
JVMs in ContainersJVMs in Containers
JVMs in Containers
 
Coding Your Way to Java 12
Coding Your Way to Java 12Coding Your Way to Java 12
Coding Your Way to Java 12
 
Java & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate FrameworkJava & J2EE Struts with Hibernate Framework
Java & J2EE Struts with Hibernate Framework
 
Spring Framework
Spring Framework  Spring Framework
Spring Framework
 
JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014JavaFX Versus HTML5 - JavaOne 2014
JavaFX Versus HTML5 - JavaOne 2014
 
Java EE 8: On the Horizon
Java EE 8:  On the HorizonJava EE 8:  On the Horizon
Java EE 8: On the Horizon
 
Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7Building Java Desktop Apps with JavaFX 8 and Java EE 7
Building Java Desktop Apps with JavaFX 8 and Java EE 7
 
Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans Spring - Part 1 - IoC, Di and Beans
Spring - Part 1 - IoC, Di and Beans
 
Spring framework
Spring frameworkSpring framework
Spring framework
 
Java EE 8 Update
Java EE 8 UpdateJava EE 8 Update
Java EE 8 Update
 
Java EE 8
Java EE 8Java EE 8
Java EE 8
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVC
 
Spring Framework Rohit
Spring Framework RohitSpring Framework Rohit
Spring Framework Rohit
 
Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009
 
Advance java Online Training in Hyderabad
Advance java Online Training in HyderabadAdvance java Online Training in Hyderabad
Advance java Online Training in Hyderabad
 
108 advancedjava
108 advancedjava108 advancedjava
108 advancedjava
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Spring Mvc,Java, Spring
Spring Mvc,Java, SpringSpring Mvc,Java, Spring
Spring Mvc,Java, Spring
 

Destaque

Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Chris Richardson
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application DevelopmentChristian Baranowski
 
OSGi und Spring MVC - inovex BrownBag
OSGi und Spring MVC - inovex BrownBag OSGi und Spring MVC - inovex BrownBag
OSGi und Spring MVC - inovex BrownBag inovex GmbH
 
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff NorrisRESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norrismfrancis
 
2011 03-15 achieving government financial management implementation success
2011 03-15 achieving government financial management implementation success2011 03-15 achieving government financial management implementation success
2011 03-15 achieving government financial management implementation successFreeBalance
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkGuo Albert
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Makmfrancis
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean ArchitectureMattia Battiston
 
SpringMVC 전체 흐름 알아보기
SpringMVC 전체 흐름 알아보기SpringMVC 전체 흐름 알아보기
SpringMVC 전체 흐름 알아보기Myung Woon Oh
 
Pp General Businesses
Pp General BusinessesPp General Businesses
Pp General Businessesjgbennett2
 
LID Presentation
LID PresentationLID Presentation
LID Presentationcestrong
 
AWS Entreprise Summit Oct 2016
AWS Entreprise Summit Oct 2016AWS Entreprise Summit Oct 2016
AWS Entreprise Summit Oct 2016Xavier Michallet
 
Old State Capitol
Old State CapitolOld State Capitol
Old State Capitoljaponville
 
SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...
SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...
SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...Angie Pascale
 
mobilebillboard2go_presentations_2015
mobilebillboard2go_presentations_2015mobilebillboard2go_presentations_2015
mobilebillboard2go_presentations_2015uguryilmaz
 
Globe theater ppt
Globe theater pptGlobe theater ppt
Globe theater pptprtoomer
 
Sierra sur times
Sierra sur timesSierra sur times
Sierra sur timesyorogo74
 

Destaque (20)

Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)Developing modular, polyglot applications with Spring (SpringOne India 2012)
Developing modular, polyglot applications with Spring (SpringOne India 2012)
 
OSGi and Spring Data for simple (Web) Application Development
OSGi and Spring Data  for simple (Web) Application DevelopmentOSGi and Spring Data  for simple (Web) Application Development
OSGi and Spring Data for simple (Web) Application Development
 
OSGi und Spring MVC - inovex BrownBag
OSGi und Spring MVC - inovex BrownBag OSGi und Spring MVC - inovex BrownBag
OSGi und Spring MVC - inovex BrownBag
 
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff NorrisRESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
RESTful OSGi Web Applications Tutorial - Khawaja S Shams & Jeff Norris
 
2011 03-15 achieving government financial management implementation success
2011 03-15 achieving government financial management implementation success2011 03-15 achieving government financial management implementation success
2011 03-15 achieving government financial management implementation success
 
Java Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC FrameworkJava Server Faces + Spring MVC Framework
Java Server Faces + Spring MVC Framework
 
Modular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S MakModular JavaScript in an OSGi World - S Mak
Modular JavaScript in an OSGi World - S Mak
 
Real Life Clean Architecture
Real Life Clean ArchitectureReal Life Clean Architecture
Real Life Clean Architecture
 
History of java'
History of java'History of java'
History of java'
 
SpringMVC 전체 흐름 알아보기
SpringMVC 전체 흐름 알아보기SpringMVC 전체 흐름 알아보기
SpringMVC 전체 흐름 알아보기
 
Pp General Businesses
Pp General BusinessesPp General Businesses
Pp General Businesses
 
Routing plugin for JOSM
Routing plugin for JOSMRouting plugin for JOSM
Routing plugin for JOSM
 
LID Presentation
LID PresentationLID Presentation
LID Presentation
 
AWS Entreprise Summit Oct 2016
AWS Entreprise Summit Oct 2016AWS Entreprise Summit Oct 2016
AWS Entreprise Summit Oct 2016
 
Old State Capitol
Old State CapitolOld State Capitol
Old State Capitol
 
Forum
ForumForum
Forum
 
SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...
SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...
SES Chicago - Advanced Local Search & Social Media StrategiesSES Chicago - Ad...
 
mobilebillboard2go_presentations_2015
mobilebillboard2go_presentations_2015mobilebillboard2go_presentations_2015
mobilebillboard2go_presentations_2015
 
Globe theater ppt
Globe theater pptGlobe theater ppt
Globe theater ppt
 
Sierra sur times
Sierra sur timesSierra sur times
Sierra sur times
 

Semelhante a Developing Modular Java Applications with Spring and OSGi

SOA with Zend Framework
SOA with Zend FrameworkSOA with Zend Framework
SOA with Zend FrameworkMike Willbanks
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Phil Leggetter
 
Building a server platform with os gi
Building a server platform with os giBuilding a server platform with os gi
Building a server platform with os giDileepa Jayakody
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Adam Mokan
 
Microservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud FoundryMicroservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud FoundryEmilio Garcia
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesQamar Abbas
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkASG
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best PracticesPavel Mička
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to SpringSujit Kumar
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Molieremfrancis
 
Docker for the enterprise
Docker for the enterpriseDocker for the enterprise
Docker for the enterpriseBert Poller
 
Comparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksComparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksAngelin R
 
Les nouveautés ASP.NET 5 avec Visual Studio 2015
Les nouveautés ASP.NET 5 avec Visual Studio 2015Les nouveautés ASP.NET 5 avec Visual Studio 2015
Les nouveautés ASP.NET 5 avec Visual Studio 2015MSDEVMTL
 
Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014Phil Leggetter
 
How to grow your own Microservice?
How to grow your own Microservice?How to grow your own Microservice?
How to grow your own Microservice?Dmitry Buzdin
 

Semelhante a Developing Modular Java Applications with Spring and OSGi (20)

Java Spring
Java SpringJava Spring
Java Spring
 
Spring
SpringSpring
Spring
 
spring
springspring
spring
 
SOA with Zend Framework
SOA with Zend FrameworkSOA with Zend Framework
SOA with Zend Framework
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Building a server platform with os gi
Building a server platform with os giBuilding a server platform with os gi
Building a server platform with os gi
 
Hybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbaiHybernat and structs, spring classes in mumbai
Hybernat and structs, spring classes in mumbai
 
Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012Single Page Applications - Desert Code Camp 2012
Single Page Applications - Desert Code Camp 2012
 
Microservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud FoundryMicroservices, Spring Cloud & Cloud Foundry
Microservices, Spring Cloud & Cloud Foundry
 
Mobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelinesMobile App Architectures & Coding guidelines
Mobile App Architectures & Coding guidelines
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Microservices: The Best Practices
Microservices: The Best PracticesMicroservices: The Best Practices
Microservices: The Best Practices
 
Introduction to Spring
Introduction to SpringIntroduction to Spring
Introduction to Spring
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
 
Docker for the enterprise
Docker for the enterpriseDocker for the enterprise
Docker for the enterprise
 
Comparison of Java Web Application Frameworks
Comparison of Java Web Application FrameworksComparison of Java Web Application Frameworks
Comparison of Java Web Application Frameworks
 
Les nouveautés ASP.NET 5 avec Visual Studio 2015
Les nouveautés ASP.NET 5 avec Visual Studio 2015Les nouveautés ASP.NET 5 avec Visual Studio 2015
Les nouveautés ASP.NET 5 avec Visual Studio 2015
 
Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014Building front-end apps that Scale - FOSDEM 2014
Building front-end apps that Scale - FOSDEM 2014
 
How to grow your own Microservice?
How to grow your own Microservice?How to grow your own Microservice?
How to grow your own Microservice?
 

Mais de Julien Dubois

Accessibility in the UK
Accessibility in the UKAccessibility in the UK
Accessibility in the UKJulien Dubois
 
Java on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introductionJava on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introductionJulien Dubois
 
JHipster Code 2020 keynote
JHipster Code 2020 keynoteJHipster Code 2020 keynote
JHipster Code 2020 keynoteJulien Dubois
 
Running Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloudRunning Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloudJulien Dubois
 
JHipster Conf 2019 English keynote
JHipster Conf 2019 English keynoteJHipster Conf 2019 English keynote
JHipster Conf 2019 English keynoteJulien Dubois
 
JHipster Conf 2019 French keynote
JHipster Conf 2019 French keynoteJHipster Conf 2019 French keynote
JHipster Conf 2019 French keynoteJulien Dubois
 
Créer et développer une communauté Open Source
Créer et développer une communauté Open SourceCréer et développer une communauté Open Source
Créer et développer une communauté Open SourceJulien Dubois
 
JHipster Conf 2018 Quiz
JHipster Conf 2018 QuizJHipster Conf 2018 Quiz
JHipster Conf 2018 QuizJulien Dubois
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterJulien Dubois
 
JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)Julien Dubois
 
Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017Julien Dubois
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipsterJulien Dubois
 
Requêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraRequêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraJulien Dubois
 
JHipster à Devoxx 2015
JHipster à Devoxx 2015JHipster à Devoxx 2015
JHipster à Devoxx 2015Julien Dubois
 
Développer et déployer dans le cloud
Développer et déployer dans le cloudDévelopper et déployer dans le cloud
Développer et déployer dans le cloudJulien Dubois
 
JHipster for Spring Boot webinar
JHipster for Spring Boot webinarJHipster for Spring Boot webinar
JHipster for Spring Boot webinarJulien Dubois
 
Gérer son environnement de développement avec Docker
Gérer son environnement de développement avec DockerGérer son environnement de développement avec Docker
Gérer son environnement de développement avec DockerJulien Dubois
 
Performance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample applicationPerformance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample applicationJulien Dubois
 

Mais de Julien Dubois (20)

Accessibility in the UK
Accessibility in the UKAccessibility in the UK
Accessibility in the UK
 
Java on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introductionJava on Azure "Back to Basics" series - databases introduction
Java on Azure "Back to Basics" series - databases introduction
 
JHipster Code 2020 keynote
JHipster Code 2020 keynoteJHipster Code 2020 keynote
JHipster Code 2020 keynote
 
Running Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloudRunning Spring Boot microservices in the cloud
Running Spring Boot microservices in the cloud
 
Spring on Azure
Spring on AzureSpring on Azure
Spring on Azure
 
JHipster Conf 2019 English keynote
JHipster Conf 2019 English keynoteJHipster Conf 2019 English keynote
JHipster Conf 2019 English keynote
 
JHipster Conf 2019 French keynote
JHipster Conf 2019 French keynoteJHipster Conf 2019 French keynote
JHipster Conf 2019 French keynote
 
Créer et développer une communauté Open Source
Créer et développer une communauté Open SourceCréer et développer une communauté Open Source
Créer et développer une communauté Open Source
 
JHipster Conf 2018 Quiz
JHipster Conf 2018 QuizJHipster Conf 2018 Quiz
JHipster Conf 2018 Quiz
 
Devoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipsterDevoxx Belgium 2017 - easy microservices with JHipster
Devoxx Belgium 2017 - easy microservices with JHipster
 
JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)JHipster overview and roadmap (August 2017)
JHipster overview and roadmap (August 2017)
 
Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017Être productif avec JHipster - Devoxx France 2017
Être productif avec JHipster - Devoxx France 2017
 
Devoxx : being productive with JHipster
Devoxx : being productive with JHipsterDevoxx : being productive with JHipster
Devoxx : being productive with JHipster
 
JHipster overview
JHipster overviewJHipster overview
JHipster overview
 
Requêtes multi-critères avec Cassandra
Requêtes multi-critères avec CassandraRequêtes multi-critères avec Cassandra
Requêtes multi-critères avec Cassandra
 
JHipster à Devoxx 2015
JHipster à Devoxx 2015JHipster à Devoxx 2015
JHipster à Devoxx 2015
 
Développer et déployer dans le cloud
Développer et déployer dans le cloudDévelopper et déployer dans le cloud
Développer et déployer dans le cloud
 
JHipster for Spring Boot webinar
JHipster for Spring Boot webinarJHipster for Spring Boot webinar
JHipster for Spring Boot webinar
 
Gérer son environnement de développement avec Docker
Gérer son environnement de développement avec DockerGérer son environnement de développement avec Docker
Gérer son environnement de développement avec Docker
 
Performance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample applicationPerformance tuning the Spring Pet Clinic sample application
Performance tuning the Spring Pet Clinic sample application
 

Último

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Último (20)

Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Developing Modular Java Applications with Spring and OSGi

  • 1. Julien Dubois Developing modular Java France Regional Director applications SpringSource
  • 2. Julien Dubois • France Regional Director, SpringSource • Book author :« Spring par la pratique » (Eyrolles, 2006) – new edition coming soon! • 10 years of experience in Java development • Member of OSSGTP
  • 3. Why do we want modular applications in the first place? • Dividing a complex problem into simpler, more manageable problems is a well-known technique since 400 years (Descartes) • Improved quality • Lower complexity • Modules are easy to reuse across an application or even several applications • Improved time-to-market • Lower costs • Only true for “enterprise-grade” applications
  • 4. Agenda • Modules, layers and errors • Doing a layered Spring application the easy way • Modular Java with Spring and OSGi • Modularity in the cloud
  • 5. Agenda • Modules, layers and errors • Doing a layered Spring application the easy way • Modular Java with Spring and OSGi • Modularity in the cloud
  • 6. Modularity & layers • Typical Java applications are separated in layers Presentation Service Repository Layer Layer Layer Object Object Object Object Object Object Object Object Object
  • 7. Modularity is more than layers • 1 module = 1 layer is the simplest solution • Good enough for smaller projects • Modules can be horizontal and vertical • Modules per layer : as seen in the previous slide • Modules per functionality : admin module, accounting module Service Repository Admin module Layer Layer Accounting module
  • 8. Errors • Many architects want those layers to be well-separated • They separate those layers physically – “let’s do EJB 1 again!” Server A Server B Remoting • As seen in the biggest French IT consulting firms, banks, telecom companies, healthcare companies, etc… during the last decade. • This essentially comes from poorly-designed specs (EJBs) written by hardware vendors…
  • 9. What is the problem? • Adding more servers will never make your application more scalable • Remoting is slow and inefficient • A remoting call is several orders of magnitude slower than a local one • Remoting also affects your GC time : all those remote objects are being garbage collected… • Adding more servers will just add more network issues • You do not need to physically separate your modules to have a modular application
  • 10. Agenda • Modules, layers and errors • Doing a layered Spring application the easy way • Modular Java with Spring and OSGi • Modularity in the cloud
  • 11. Spring & Layers • Let’s do this architecture with local Spring beans Presentation Service Repository Layer Layer Layer Object Object Object Object Object Object Object Object Object
  • 12. Separating layers with Spring • The good news : with Spring, it works out of the box! • Spring even has some specific Java annotations for this : • @Controller for a Spring MVC controller (presentation layer) • @Service for a Spring business bean (service layer) • @Repository for a Spring repository bean (repository layer) • There are many other ways to do this with Spring • Using naming conventions with component scanning • Using Spring’s XML configuration file
  • 13. Layered Spring application • A layered Spring application Presentation Service Repository Layer Layer Layer @Controller @Service @Repository @Controller @Service @Repository @Controller @Service @Repository
  • 14. Show me the code! package myapplication.service; This Spring Bean belongs to the Service layer @Service public class AccountServiceImpl implements AccountService { Injecting a Spring bean from the Repository layer @Autowired private AccountRepository accountRepo; @Transactional @Secured("ROLE_MANAGER") public void addAccount(String login) { Account account = new Account(login); account.setPassword(“changeme”); accountRepo.save(account); } }
  • 15. Spring’s hierarchical application contexts • Spring also provides a hierarchy of application contexts out of the box. By default (no specific configuration to do) : • There is a “root” application context, which contains the repository and service layers • The presentation layer (Spring @MVC) is a child of this root context : • @Controller beans see @Service beans, but not the opposite • Web Services written with Spring WS also have their own child application context
  • 16. Default Spring configuration @MVC Application Root Application Context Context @Repository @Controller @Service @Repository WS Application @Service Context @Repository @Endpoint
  • 17. Separating layers with Spring • The code we have seen is : • Easy to code and test • Very performant in production • Still well-separated in layers • This is Spring default’s configuration • Works out of the box • This can be customized in many, many different ways • You do not need to physically separate your layers to have a layered application
  • 18. Agenda • Modules, layers and errors • Doing a layered Spring application the easy way • Modular Java with Spring and OSGi • Modularity in the cloud
  • 19. The problem with the previous slides • However, what we have just done is a monolithic application • Everything is put into a single deployment unit (a WAR file) • Memory is shared between all modules : not secured • What you want as a developer is : • Updating your application at runtime, and not redeploy your WAR file all the time • What your users want is : • New functionalities hot deployed at runtime • High availability • But how can we change modules at runtime??
  • 20. Introducing OSGi • OSGi is a specification • Used since many years in the telecom industry • With several implementations in Java : for instance Equinox, which is the basis of the Eclipse IDE
  • 21. It's a module system • Partition a system into a number of modules – "bundles" • Each bundle has its own memory space Presentation module Version 1.0 @Controller • Strict visibility rules Service module Version 1.0 • Resolution process @Service • satisfies dependencies of a module Repository module Version 2.0 @Repository • Understands versioning
  • 22. It's dynamic • Modules can be • installed Service module Version 1.0 • started @Service • stopped • uninstalled • updated Service module Version 2.0 @Service • ...at runtime
  • 23. It's even service-oriented • Bundles can publish services • dynamically • Service Registry allows other bundles to find services • and to bind to them • Services come and go at runtime, all taken care of for you
  • 24. Introducing Spring Dynamic Modules • Doing OSGi directly is complex • It also makes your code dependant on the OSGi APIs • Spring Dynamic Modules is a Spring project, backed by SpringSource • No OSGi in your code • Your Spring beans are just configured to be OSGi services • It’s easy to move a project to/from OSGi • Moving from Spring to Spring+OSGi is easy • Going back from Spring+OSGi to Spring is also easy
  • 25. Introducing Spring Dynamic Modules • Configuring Spring beans • Just put your Spring configuration Best Practice files in /META-INF/spring Separate your • It’s easy to export a Spring Bean to business code the OSGi registry from your infrastructure • It’s easy to inject a Spring Bean from code! another bundle <beans ...> <bean id="customerDAO" class="dao.CustomerDAO"/> <osgi:service ref="customerDAO" interface="dao.ICustomerDAO"/> <osgi:reference id="dataSource" interface="javax.sql.DataSource"/> </beans>
  • 26. Who supports OSGi? • Most application server vendors base their systems on OSGi • Validates the usage of OSGi as a solution for modular applications • But none offers OSGi as a programming model for the customer • Why shouldn't the customer be as empowered as the application server vendor?
  • 27. Enter SpringSource dm Server • The short version : it’s Spring, Tomcat and OSGi working all together • Allows powerful and modular applications + +
  • 28. dm Server empowers you to use OSGi • dm Server allows you to use OSGi-based applications, running in an application server : Spring MVC Spring Framework Database Connection Pool Service Repository Admin module module module Accounting module
  • 29. Features for developers • For developers : • A truly modular architecture : secured modules, with a well- defined lifecycle • More productivity Spring Framework Database thanks to the Spring MVC Connection Pool hot-deployment of modules during development time : you only work on your Admin module module, not on the Service Repository module whole application module Accounting module
  • 30. Features for production • For the production team : • Hot deployment of modules of the application at runtime : lower downtime Spring Framework • Several versions of Database Connection Pool the same module can be deployed in parallel Service module • Better usage of the Version 1.0 Repository server resources : Service module dm Server only loads module modules that are Version 2.0 actually needed!
  • 31. dm Server summary • dm Server is the only application server that gives the power of OSGi to development and production teams • dm Server is built on standard, widely used, Open Source components : Spring, Tomcat, Equinox • Of course, dm Server is free software (GPL v3), so why don’t you start writing applications with it?
  • 32. Agenda • Modules, layers and errors • Doing a layered Spring application the easy way • Modular Java with Spring and OSGi • Modularity in the cloud
  • 33. Clustering • The idea is to separate the load on several identical nodes Apache httpd dm Server dm Server dm Server Module
  • 34. Cloud computing & virtualization • Experience shows that clusters are often widely under-utilized… Because you don’t need all the nodes all the time. • Cloud computing allows renting computing power on demand • You can rent servers per hour with : Amazon EC2, Google AppEngine, Gandi Flex (in France)… • Companies datacenters are moving to virtualization for this same reason
  • 35. dm Server in the cloud • Virtualization solution : SpringSource works with VMWare to provide new tools and support for dm Server in a virtualized environment • IaaS (Infrastructure As A Service) solution : Amazon EC2 & Gandi Flex just provide the hardware… dm Server already runs on those systems • PaaS (Platform As A Service) solution : No OSGi support on those solutions, but there is Groovy and Grails support on Google AppEngine (in cooperation with Google)
  • 36. Cost reduction is king • This can be far less expensive than a traditional cluster as long as : • You can monitor your load properly • You can estimate your needs in advance (launching a new EC2 instance can take a few minutes) • But with the current global economic climate, there is a very strong move towards those solutions
  • 37. Hyperic • SpringSource has just bought Hyperic (May 2009) • Hyperic is a leader in management and montoring • Hyperic already proposes CloudStatus, that monitors Amazon EC2 and Google AppEngine
  • 38. Dynamic provisionning • Currently our monitoring & management tools are able to : • Manage a group of servers : for example, deploying an application on 100 dm Server nodes with one click • Monitor a large group of nodes, including on the cloud or in a virtualized environment • In the future, those tools will evolve to be able to do “provisionning”: dynamically adjust the number of running nodes depending on the load
  • 39. Summary • Complex applications should be split into modules : reduced cost, improved time-to-market • If you want to split your application into modules at build time, Spring provides an excellent solution out of the box: there’s no need to go for more complex (and inferior) solutions Use tc Server (= enterprise version of Tomcat) and Spring • If you want secured, well-defined modules that can be dynamically updated at runtime, Spring and OSGi offer a perfect solution Use dm Server (Tomcat + OSGi) and Spring • Be ready for the future : cloud computing offers un-beatable scalability and costs. Both tc Server and dm Server are ready!