In this session you will learn:
1.Spring Framework
2. Core Container
3. Data Access/Integration
4. Web Layer
5. Spring Setup
6. Key features
7. Spring Bean
8. Dependency Injection
9. Relation between DI and IoC
10. Spring IoC Containers
11. Spring DI
In this Java Hibernate Training session, you will learn Integrating Struts with Hibernate. Topics covered in this session are:
• Struts 2
• Struts Action Class
• Validation
• Control Tags
• Data Tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java Hibernate Training session, you will learn Introducing Struts Framework. Topics covered in this session are:
• Introduction to Struts Framework
• Features
• Evolution
• Struts Demo
• Declarative validation
• Architecture
• Validators
• Interceptors
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this session you will learn:
1. Introduction to Struts Framework
2. Features
3. Evolution
4. Struts Demo
5. Declarative validation
6. Architecture
7. Validators
8. Interceptors
In this session, you will learn:
1. Generator Class in Hibernate
2. SQL Dialects
3. Collection Mapping
4. One-to-one Mapping
5. Cascade Types
6. Many to one / One to many
7. Hibernate Lazy Loading
8. Transaction Management
9. HQL – Hibernate Query Language
10. HCQL – Hibernate Criteria Query Language
11. Hibernate Caching
In this Java Spring Training session, you will learn Spring MVC. Topics covered in this session are:
For more information, visit this link:
• Spring framework
• Inversion of Control
• Dependency Injection – Two types
• Defining beans using XML
• Inheriting beans
• Auto-wiring
• Annotations based configuration
• Java based configuration
• Spring AOP
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java Hibernate Training session, you will learn Hibernate part -2. Topics covered in this session are:
• Generator Class in Hibernate
• SQL Dialects
• Collection Mapping
• One-to-one Mapping
• Cascade Types
• Many to one / One to many
• Hibernate Lazy Loading
• Transaction Management
• HQL – Hibernate Query Language
• HCQL – Hibernate Criteria Query Language
• Hibernate Caching
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java Hibernate Training session, you will learn Integrating Struts with Hibernate. Topics covered in this session are:
• Struts 2
• Struts Action Class
• Validation
• Control Tags
• Data Tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java Hibernate Training session, you will learn Introducing Struts Framework. Topics covered in this session are:
• Introduction to Struts Framework
• Features
• Evolution
• Struts Demo
• Declarative validation
• Architecture
• Validators
• Interceptors
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this session you will learn:
1. Introduction to Struts Framework
2. Features
3. Evolution
4. Struts Demo
5. Declarative validation
6. Architecture
7. Validators
8. Interceptors
In this session, you will learn:
1. Generator Class in Hibernate
2. SQL Dialects
3. Collection Mapping
4. One-to-one Mapping
5. Cascade Types
6. Many to one / One to many
7. Hibernate Lazy Loading
8. Transaction Management
9. HQL – Hibernate Query Language
10. HCQL – Hibernate Criteria Query Language
11. Hibernate Caching
In this Java Spring Training session, you will learn Spring MVC. Topics covered in this session are:
For more information, visit this link:
• Spring framework
• Inversion of Control
• Dependency Injection – Two types
• Defining beans using XML
• Inheriting beans
• Auto-wiring
• Annotations based configuration
• Java based configuration
• Spring AOP
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java Hibernate Training session, you will learn Hibernate part -2. Topics covered in this session are:
• Generator Class in Hibernate
• SQL Dialects
• Collection Mapping
• One-to-one Mapping
• Cascade Types
• Many to one / One to many
• Hibernate Lazy Loading
• Transaction Management
• HQL – Hibernate Query Language
• HCQL – Hibernate Criteria Query Language
• Hibernate Caching
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java Spring Training session, you will learn Spring – Inversion of Control, Dependency Injection and Bean definitions. Topics covered in this session are:
For more information, visit this link:
Spring Framework
• Core Container
• Data Access/Integration
• Web Layer
• Spring Setup
• Key features
• Spring Bean
• Dependency Injection
• Relation between DI and IoC
• Spring IoC Containers
• Spring DI
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java Spring Training session, you will learn Spring AOP – Aspect Oriented Programming Topics covered in this session are:
For more information, visit this link:
• Auto-wiring
• Annotations based configuration
• Java based configuration
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP (Java Server Pages Technology)
• JSP vs Servlet
• MVC Architecture
• Scriplet
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
In this core java training session, you will learn Java IO – Files, Streams and
Object Serialization. Topics covered in this session are:
• Java IO
• Files
• Streams
• Byte-based
• Character-based
• Object Serialization
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP vs Servlet
• LifeCycle of Servlet
• JSP Elements
• JSP Page directive
• Directives vs Action tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlArjun Thakur
Hi, I just prepared a presentation on Java Spring Framework, the topics covered include architecture of Spring framework and it's modules. Spring Core is explained in detail including but not limited to Inversion of Control (IoC), Dependency Injection (DI) etc. Thank you and happy learning. :)
In this presentation I will go through latest features being added in Spring 3.1/3.2 one more time and also will try to look behind the scene on what new features are comming in Spring 4 which should be released at the end of this year.
In this session, you will learn:
1. Hibernate
2. Advantages of Hibernate
3. Hibernate Architecture – High Level
4. Hibernate – Detailed Architecture
5. Hibernate Architecture – Important Levels
6. Hibernate jar files
7. Hibernate tools download
8. CRUD Operations
9. Hibernate with Annotations
10. Design Patterns in Java
In this Java Hibernate Training session, you will learn Hibernate. Topics covered in this session are:
• Hibernate
• Advantage of hibernate
• Hibernate Architecture
• Hibernate project
• Hibernate with Annotations
• DAO Design Pattern in Java
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
In this Java Spring Training session, you will learn Spring – Inversion of Control, Dependency Injection and Bean definitions. Topics covered in this session are:
For more information, visit this link:
Spring Framework
• Core Container
• Data Access/Integration
• Web Layer
• Spring Setup
• Key features
• Spring Bean
• Dependency Injection
• Relation between DI and IoC
• Spring IoC Containers
• Spring DI
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java Spring Training session, you will learn Spring AOP – Aspect Oriented Programming Topics covered in this session are:
For more information, visit this link:
• Auto-wiring
• Annotations based configuration
• Java based configuration
https://www.mindsmapped.com/courses/software-development/spring-fundamentals-learn-spring-framework-and-spring-boot/
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP (Java Server Pages Technology)
• JSP vs Servlet
• MVC Architecture
• Scriplet
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
In this core java training session, you will learn Java IO – Files, Streams and
Object Serialization. Topics covered in this session are:
• Java IO
• Files
• Streams
• Byte-based
• Character-based
• Object Serialization
For more information about this course visit on this link: https://www.mindsmapped.com/courses/software-development/learn-java-fundamentals-hands-on-training-on-core-java-concepts/
In this Java JSP Training session, you will learn JSP. Topics covered in this session are:
• JSP vs Servlet
• LifeCycle of Servlet
• JSP Elements
• JSP Page directive
• Directives vs Action tags
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/jsp-and-servlets-designing-web-applications-with-java/
Java Spring framework, Dependency Injection, DI, IoC, Inversion of ControlArjun Thakur
Hi, I just prepared a presentation on Java Spring Framework, the topics covered include architecture of Spring framework and it's modules. Spring Core is explained in detail including but not limited to Inversion of Control (IoC), Dependency Injection (DI) etc. Thank you and happy learning. :)
In this presentation I will go through latest features being added in Spring 3.1/3.2 one more time and also will try to look behind the scene on what new features are comming in Spring 4 which should be released at the end of this year.
In this session, you will learn:
1. Hibernate
2. Advantages of Hibernate
3. Hibernate Architecture – High Level
4. Hibernate – Detailed Architecture
5. Hibernate Architecture – Important Levels
6. Hibernate jar files
7. Hibernate tools download
8. CRUD Operations
9. Hibernate with Annotations
10. Design Patterns in Java
In this Java Hibernate Training session, you will learn Hibernate. Topics covered in this session are:
• Hibernate
• Advantage of hibernate
• Hibernate Architecture
• Hibernate project
• Hibernate with Annotations
• DAO Design Pattern in Java
For more information, visit this link:
https://www.mindsmapped.com/courses/software-development/learn-hibernate-fundamentals-from-scratch/
TUTORIAL-INTRODUCTION TO SPRING FOR BEGINNERS
EXPLANATION TO-Java Framework,Advantages of using SPRING,Difference between Hibernate and Spring.Spring architecture,Spring IoC Containters,Bean scope & Method Injection,Spring Inheritance.
Frameworks are large prewritten code to which you add your own code to solve a problem in a specific domain.
You make use of a framework by calling its methods,inheritance,and supplying “call-backs” listeners.
Spring is the most popular application development framework for enterprise Java™.
Millions of developers use Spring to create high performing, easily testable, reusable code without any lock-in.
Enhance your career with spring framework Online training which helps you in mastering the real-world web applications with spring. Enroll in this course to get spring certified.
Some of the common interview questions asked during a Java Interview. These may apply to Java Interviews. Be prepared with answers for the interview questions below when you prepare for an interview. Also have an example to explain how you worked on various interview questions asked below. Java Developers are expected to have references and be able to explain from their past experiences. All the Best for a successful career as a Java Developer!
Some of the common interview questions asked during a Java Interview. These may apply to Java Interviews. Be prepared with answers for the interview questions below when you prepare for an interview. Also have an example to explain how you worked on various interview questions asked below. Java Developers are expected to have references and be able to explain from their past experiences. All the Best for a successful career as a Java Developer!
In this session you will learn:
1. Spring framework
2. Inversion of Control
3. Dependency Injection – Two types
4. Defining beans using XML
5. Inheriting beans
6. Auto-wiring
7. Annotations based on a configuration
8. Java-based configuration
9. Spring AOP
Session 34 - JDBC Best Practices, Introduction to Design PatternsPawanMM
In this session, you will learn:
1. Deployment Descriptor
2. Configuring and Mapping a Servlet
3. The flow of the demo web apps
4. JDBC Best practices
5. Design Patterns
In this session you will learn:
1. Recap of Arrays, ArrayLists
2. Basically, there can be 2 operations that you would want to perform on Arrays/ArrayLists.. (and maybe, other collections)
3. Search: Override equals() and hashCode().
4. Sort: provide comparison logic – Two ways
4.1 Comparable interface
4.2 Comparator interface
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
Neuro-symbolic (NeSy) AI is on the rise. However, simply machine learning on just any symbolic structure is not sufficient to really harvest the gains of NeSy. These will only be gained when the symbolic structures have an actual semantics. I give an operational definition of semantics as “predictable inference”.
All of this illustrated with link prediction over knowledge graphs, but the argument is general.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
When stars align: studies in data quality, knowledge graphs, and machine lear...
Session 43 - Spring - Part 1 - IoC DI Beans
1. Java & JEE Training
Session 43 – Spring – Inversion of Control, Dependency
Injection and Bean definitions
2. Page 1Classification: Restricted
Agenda
Spring Framework
• Core Container
• Data Access/Integration
• Web Layer
• Spring Setup
• Key features
• Spring Bean
• Dependency Injection
• Relation between DI and IoC
• Spring IoC Containers
• Spring DI
3. Page 2Classification: Restricted
Spring Framework
• Spring is the most popular application development framework for
enterprise Java.
• Open source Java platform since 2003.
• Spring supports all major application servers and JEE standards.
• Spring handles the infrastructure so you can focus on your application
• https://spring.io/
6. Page 5Classification: Restricted
Core Container
• The Core module provides the fundamental parts of the framework,
including the IoC and Dependency Injection features.
• The Bean module provides BeanFactory which is a sophisticated
implementation of the factory pattern.
• The Context module builds on the solid base provided by the Core and
Beans modules and it is a medium to access any objects defined and
configured. The ApplicationContext interface is the focal point of the
Context module.
• The SpEL module provides a powerful expression language for querying and
manipulating an object graph at runtime.
7. Page 6Classification: Restricted
Data Access / Integration
• The JDBC module provides a JDBC-abstraction layer that removes the need
to do tedious JDBC related coding.
• The ORM module provides integration layers for popular object-relational
mapping APIs, including JPA, JDO, Hibernate, and iBatis.
• The OXM module provides an abstraction layer that supports Object/XML
mapping implementations for JAXB, Castor, XMLBeans, JiBX and XStream.
• The Java Messaging Service JMS module contains features for producing
and consuming messages.
• The Transaction module supports programmatic and declarative
transaction management for classes that implement special interfaces and
for all your POJOs.
8. Page 7Classification: Restricted
Web Layer
• The Web module provides basic web-oriented integration features such as
multipart file-upload functionality and the initialization of the IoC container
using servlet listeners and a web-oriented application context.
• The Web-MVC module contains Spring's model-view-controller (MVC)
implementation for web applications.
• The Web-Socket module provides support for WebSocket-based, two-way
communication between client and server in web applications.
• The Web-Portlet module provides the MVC implementation to be used in a
portlet environment and mirrors the functionality of Web-Servlet module.
9. Page 8Classification: Restricted
Miscellaneous
• The AOP module provides aspect-oriented programming implementation
allowing you to define method-interceptors and pointcuts to cleanly
decouple code that implements functionality that should be separated.
• The Aspects module provides integration with AspectJ which is again a
powerful and mature aspect oriented programming (AOP) framework.
• The Instrumentation module provides class instrumentation support and
class loader implementations to be used in certain application servers.
• The Messaging module provides support for STOMP as the WebSocket sub-
protocol to use in applications. It also supports an annotation programming
model for routing and processing STOMP messages from WebSocket
clients.
• The Test module supports the testing of Spring components with JUnit or
TestNG frameworks.
10. Page 9Classification: Restricted
Spring setup
• Download jars here…
http://repo.spring.io/release/org/springframework/spring/
• Unzip spring-framework-4.x.x.RELEASE-dist.zip
• Jars are available within spring/libs
• Also download jars for Apache Commons Logging
http://commons.apache.org/proper/commons-
logging/download_logging.cgi
• Or use Maven
12. Page 11Classification: Restricted
Key features of Spring Framework
• Dependency Injection and Inversion of Control
• Aspect Oriented Programming
• Spring Modules
14. Page 13Classification: Restricted
Dependency Injection
• The technology that actually defines Spring (Heart of Spring).
• Dependency Injection helps us to keep our classes as indepedent as
possible.
• Increase reuse by applying low coupling
• Easy testing
• More understandable
15. Page 14Classification: Restricted
Dependency Injection
• Dependency injection is a pattern where the container passes objects by
name to other objects, via either constructors, properties, or factory
methods.
• An injection is the passing of a dependency (a service) to a
dependent object (a client). Passing the service to the client, rather than
allowing a client to build or find the service, is the fundamental
requirement of the pattern.
• Two types of Dependency Injection:
• Constructor based
• Setter based
16. Page 15Classification: Restricted
Relation between DI and IoC
• In software engineering, inversion of control (IoC) describes a design in
which custom-written portions of a computer program receive the flow of
control from a generic, reusable library.
• The Inversion of Control (IoC) is a general concept, and it can be expressed
in many different ways and dependency Injection is merely one concrete
example of Inversion of Control.
17. Page 16Classification: Restricted
Dependency Injection - IoC Container
• The Spring container (IoC Container) is at the core of the Spring Framework.
• The container will create the objects, wire them together, configure them,
and manage their complete lifecycle from creation till destruction.
16
18. Page 17Classification: Restricted
• The container gets its instructions on
what objects to instantiate, configure,
and assemble by reading configuration
metadata provided.
• The configuration metadata can be
represented either by;
• XML,
• Java annotations,
• Java code.
Dependency Injection - IoC Container
19. Page 18Classification: Restricted
Spring IoC Containers…
• Spring BeanFactory Container
• Spring ApplicationContext Container – Recommended for most purposes
Note: The ApplicationContext container includes all functionality of
the BeanFactory container, so it is generally recommended over
the BeanFactory. BeanFactory can still be used for light weight applications
like mobile devices or applet based applications where data volume and
speed is significant.
20. Page 19Classification: Restricted
Dependency Injection - Code Example
19
To instantiate the above classes, one way is to do the usual new operator like new
Foo() or new Bar() OR we can use the Spring dependency injection to instantiate these
classes and set the properties accordingly.
22. Page 21Classification: Restricted
Dependency Injection - Code Example
21
Spring's ClassPathXmlApplicationContext is the commonly used object that
hold the information of all the beans that it instantiates.
23. Page 22Classification: Restricted
Dependency Injection - Bean Scopes
22
Scope Description
Singleton (Default) Scopes a single bean definition to a single object instance per Spring
IoC container.
Prototype Scopes a single bean definition to any number of object instances.
25. Page 24Classification: Restricted
Other Bean Scopes
Scope Description
singleton This scopes the bean definition to a single instance per
Spring IoC container (default).
prototype This scopes a single bean definition to have any number of
object instances.
request This scopes a bean definition to an HTTP request. Only valid
in the context of a web-aware Spring ApplicationContext.
session This scopes a bean definition to an HTTP session. Only valid
in the context of a web-aware Spring ApplicationContext.
global-
session
This scopes a bean definition to a global HTTP session. Only
valid in the context of a web-aware Spring
ApplicationContext.
26. Page 25Classification: Restricted
Bean definition – Configuration metadata
Properties Description
class This attribute is mandatory and specify the bean class to be used to create
the bean.
Name /id This attribute specifies the bean identifier uniquely. In XML-based
configuration metadata, you use the id and/or name attributes to specify
the bean identifier(s).
scope This attribute specifies the scope of the objects created from a particular
bean definition and it will be discussed in bean scopes chapter.
constructor-
arg
This is used to inject the dependencies and will be discussed later
properties This is used to inject the dependencies and will be discussed later
autowiring
mode
This is used to inject the dependencies and will be discussed later
lazy-
initialization
mode
A lazy-initialized bean tells the IoC container to create a bean instance
when it is first requested, rather than at startup. Default is false.
initialization
method
A callback to be called just after all necessary properties on the bean have
been set by the container. It will be discussed in bean life cycle chapter.
destruction
method
A callback to be used when the container containing the bean is destroyed.
It will be discussed in bean life cycle chapter.
28. Page 27Classification: Restricted
Spring Bean Life-Cycle methods – init and destroy
<bean id="exampleBean"
class="examples.ExampleBean"
init-method=“init”
destroy-method=“destroy” />
public class ExampleBean {
public void init() {
// do some initialization work
}
public void destroy() {
// do some destruction work
}
}
Note: you need to register a shutdown hook registerShutdownHook() method that is declared on
the AbstractApplicationContext class. This will ensures a graceful shutdown and calls the relevant
destroy methods.
32. Page 31Classification: Restricted
Constructor based DI
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Definition for textEditor bean -->
<bean id="textEditor" class=“demo.TextEditor">
<constructor-arg ref="spellChecker"/>
</bean>
<!-- Definition for spellChecker bean -->
<bean id="spellChecker" class=“demo.SpellChecker">
</bean>
</beans>
33. Page 32Classification: Restricted
Setter based DI
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Definition for textEditor bean using inner bean -->
<bean id="textEditor" class=“demo.TextEditor">
<property name="spellChecker">
<bean id="spellChecker" class=“demo.SpellChecker"/>
</property>
</bean>
</beans>
34. Page 33Classification: Restricted
Exercise:
• Create a Quiz Application
• A Quiz has a list of Questions and associated Answers
• Every Answer associated with a question is a set of answers submitted by
multiple persons
• Inject the list of questions and associated answer set for each question
using DI using beans.xml
• E.g. Question 1: Is Java an OOP language?
Answer 1a: Yes (by Bill)
Answer 1b: Yes, it is (by John)
Answer 1c: No, it is not (by Jack) … no limit on number of answers
Note: Every set of answers is actually a list of answer objects. Each answer
object has an id, answerString, submittedBy. So we need to understand how
this collection can be injected in Beans.xml