WEBVTT

1
00:00:00.500 --> 00:00:01.590
<v Narrator>Hey, in this video,</v>

2
00:00:01.590 --> 00:00:04.340
I'm going to give you an overview of the Spring Framework.

3
00:00:06.700 --> 00:00:09.990
So, first off, here's the official website for Spring.

4
00:00:09.990 --> 00:00:12.020
It's at www.spring.io.

5
00:00:12.020 --> 00:00:13.010
So, this is where you can get

6
00:00:13.010 --> 00:00:14.730
all the documentation for Spring,

7
00:00:14.730 --> 00:00:17.710
you can download Spring, you can look at some tutorials

8
00:00:17.710 --> 00:00:20.020
and also some getting started guides,

9
00:00:20.020 --> 00:00:23.033
and we'll use this website a lot during this course.

10
00:00:25.597 --> 00:00:27.290
So, why Spring?

11
00:00:27.290 --> 00:00:30.330
And I covered this in the last video, but again,

12
00:00:30.330 --> 00:00:33.940
in a nutshell, it's to simplify Java Enterprise Development,

13
00:00:33.940 --> 00:00:36.100
make it much simpler than what we had

14
00:00:36.100 --> 00:00:38.240
in J2EE or Java EE,

15
00:00:38.240 --> 00:00:39.923
and I gave all the pros and cons for that

16
00:00:39.923 --> 00:00:41.823
in the previous video.

17
00:00:42.800 --> 00:00:44.470
So, here, let's kind of drill down a bit

18
00:00:44.470 --> 00:00:47.590
and talk about the goals of Spring, like what are the goals.

19
00:00:47.590 --> 00:00:51.047
Well, first off, lightweight development with Java POJOs,

20
00:00:51.047 --> 00:00:53.940
and POJOs mean Plain Old Java Objects,

21
00:00:53.940 --> 00:00:55.500
make it much simpler to build,

22
00:00:55.500 --> 00:00:57.487
as compared to the heavyweight EJBs

23
00:00:57.487 --> 00:01:00.573
from the early versions of J2EE.

24
00:01:01.630 --> 00:01:03.660
And then also, we want to promote loose coupling

25
00:01:03.660 --> 00:01:06.100
by making use of dependency injection.

26
00:01:06.100 --> 00:01:08.332
So instead of hard wiring your objects together,

27
00:01:08.332 --> 00:01:11.640
you simply specify the wiring via a configuration file

28
00:01:11.640 --> 00:01:15.250
or annotations, and we'll cover that a lot in this course.

29
00:01:15.250 --> 00:01:17.580
Then the next idea is declarative programming

30
00:01:17.580 --> 00:01:19.820
with Aspect Oriented Programming, or AOP.

31
00:01:19.820 --> 00:01:22.800
This'll basically allow you to add

32
00:01:22.800 --> 00:01:26.763
some applicationwide services to your given objects.

33
00:01:29.080 --> 00:01:30.660
And then finally, the main thing here

34
00:01:30.660 --> 00:01:33.480
is to minimize boilerplate Java code.

35
00:01:33.480 --> 00:01:36.530
So in the early days of J2EE, there was a lot of code

36
00:01:36.530 --> 00:01:38.850
that you had to write, and so the folks at Spring,

37
00:01:38.850 --> 00:01:40.917
they created a collection of helper classes

38
00:01:40.917 --> 00:01:42.700
to make it easier,

39
00:01:42.700 --> 00:01:45.900
and again, to minimize all of the boilerplate code,

40
00:01:45.900 --> 00:01:47.490
and we'll see some examples of that

41
00:01:47.490 --> 00:01:48.940
a little later in the course.

42
00:01:50.810 --> 00:01:53.290
Now, this is kind of a big picture here,

43
00:01:53.290 --> 00:01:54.750
of the Spring Framework and this is kind of

44
00:01:54.750 --> 00:01:56.580
like the core Framework.

45
00:01:56.580 --> 00:01:57.940
And what I'll do is I'll actually

46
00:01:57.940 --> 00:02:00.160
go through these various sections here

47
00:02:00.160 --> 00:02:01.429
and just give you a quick overview,

48
00:02:01.429 --> 00:02:03.513
as far as what they're about.

49
00:02:06.310 --> 00:02:07.720
Alright, so let's go ahead and start here

50
00:02:07.720 --> 00:02:09.210
with the Core Container.

51
00:02:09.210 --> 00:02:12.850
So the Core Container's like the heartthrob, the main,

52
00:02:12.850 --> 00:02:15.490
I guess, the main item here of Spring.

53
00:02:15.490 --> 00:02:18.334
So basically, it manages how Beans are created.

54
00:02:18.334 --> 00:02:22.200
It has a Bean factory for creating the Beans.

55
00:02:22.200 --> 00:02:24.360
It basically can reconfig. files

56
00:02:24.360 --> 00:02:26.676
for setting properties, independencies

57
00:02:26.676 --> 00:02:30.330
and also the Context here's really the Spring Container

58
00:02:30.330 --> 00:02:32.500
that holds the Beans in memory.

59
00:02:32.500 --> 00:02:34.273
And then there's SpEL,

60
00:02:34.273 --> 00:02:35.900
that's for the Spring Expression Language,

61
00:02:35.900 --> 00:02:38.010
so it's a little language we can use

62
00:02:38.010 --> 00:02:40.240
within the config. files to refer to other Beans,

63
00:02:40.240 --> 00:02:41.720
and we'll see example of that later.

64
00:02:41.720 --> 00:02:43.070
But that's kind of the Core Container,

65
00:02:43.070 --> 00:02:46.363
for creating Beans and then making those Beans available.

66
00:02:48.610 --> 00:02:50.490
So let's move over to the AOP section.

67
00:02:50.490 --> 00:02:52.200
So this is where you have support

68
00:02:52.200 --> 00:02:54.206
for Aspect Oriented Programming.

69
00:02:54.206 --> 00:02:57.450
So basically, what AOP, in a nutshell,

70
00:02:57.450 --> 00:03:01.000
it allows you to create these applicationwide services,

71
00:03:01.000 --> 00:03:06.000
like logging, security, transactions, instrumentation

72
00:03:06.330 --> 00:03:09.010
and then you can apply these services to your objects

73
00:03:09.010 --> 00:03:12.990
in a declarative fashion, so no need to modify your code

74
00:03:12.990 --> 00:03:14.550
to have support for this.

75
00:03:14.550 --> 00:03:16.990
You simply add a config. in the config. file

76
00:03:16.990 --> 00:03:18.460
or an annotation,

77
00:03:18.460 --> 00:03:22.090
and that service will be applied to your application.

78
00:03:22.090 --> 00:03:23.916
And we'll see examples of this,

79
00:03:23.916 --> 00:03:26.281
primarily when we get into some transaction work,

80
00:03:26.281 --> 00:03:29.131
but some other areas too we'll play around with it a bit.

81
00:03:30.940 --> 00:03:32.130
So then, moving forward here,

82
00:03:32.130 --> 00:03:35.314
let's take a look at the Data Access section or integration.

83
00:03:35.314 --> 00:03:38.270
So basically, here, this is for communicating

84
00:03:38.270 --> 00:03:40.360
with the database, either a relational database

85
00:03:40.360 --> 00:03:42.050
or a NoSQL database.

86
00:03:42.050 --> 00:03:44.740
And also, making use of, like, a message queue.

87
00:03:44.740 --> 00:03:46.662
So on the top left, you have JDBC.

88
00:03:46.662 --> 00:03:49.360
Basically, Spring provides some helper classes

89
00:03:49.360 --> 00:03:53.320
to make it much easier to access a database, using JDBC.

90
00:03:53.320 --> 00:03:56.480
And, by using these Spring JDBC classes,

91
00:03:56.480 --> 00:04:00.670
you can actually reduce your source code by over 50%,

92
00:04:00.670 --> 00:04:03.380
so a lot of good helper classes there.

93
00:04:03.380 --> 00:04:05.230
The next little bullet there is ORM,

94
00:04:05.230 --> 00:04:07.128
for Object to Relational Mapping.

95
00:04:07.128 --> 00:04:08.997
This is probably the most popular section

96
00:04:08.997 --> 00:04:10.841
of this module, here.

97
00:04:10.841 --> 00:04:14.410
Basically, it allows you to hook into Hibernate,

98
00:04:14.410 --> 00:04:15.580
or hook into JPAs.

99
00:04:15.580 --> 00:04:17.630
A lot of support and a lot of synergy

100
00:04:17.630 --> 00:04:19.393
between Spring and Hibernate.

