Spring Notes
Spring Notes
Spring Notes
Files
Download Source Code:
This only includes the source files, no JAR files. You will need to add JAR files
separately on your own. You have two options for downloading the code.
Note: Option 1 and Option 2 both has links to the exact same code. You only need
to choose one of the options.
---
Download PDF Files
All slides which are shown during the course are available also as a reference and
can be downloaded here:
http://www.luv2code.com/download-spring-hibernate-pdfs
---
http://www.luv2code.com/download-spring-hibernate-faq-notes
When Java objects are created by the Spring Container, then Spring refers to them
as "Spring Beans".
Spring Beans are created from normal Java classes .... just like Java objects.
---
Source: https://docs.spring.io/spring/docs/current/spring-framework-reference/
core.html#beans-introduction
---
In the early days, there was a term called "Java Beans". Spring Beans have a
similar concept but Spring Beans do not follow all of the rigorous requirements of
Java Beans.
---
In summary, whenever you see "Spring Bean", just think Java object. :-)
For example:
Answer
When we pass the interface to the method, behind the scenes Spring will cast the
object for you.
context.getBean("myCoach", Coach.class)
However, there are some slight differences than normal casting.
Answer:
The getTeam() method is only defined in the CricketCoach class. It is not
part of the Coach interface.
---
When you retrieve a bean from the Spring container using the Coach
interface:
---
When you retrieve a bean from the Spring container using the CricketCoach
class:
---
The bottom line is it depends on how you retrieve the object and assign
it ... that determines the visibility you have to the methods.