WEBVTT

0
00:01.450 --> 00:02.530
<v Developer>Hey, in this video,</v>

1
00:02.530 --> 00:05.163
we're going to find out why should we use Spring.

2
00:07.900 --> 00:09.930
So, Spring in a nutshell.

3
00:09.930 --> 00:12.450
Basically, Spring is a very popular framework

4
00:12.450 --> 00:15.630
for building enterprise Java applications.

5
00:15.630 --> 00:16.960
When Spring first came out,

6
00:16.960 --> 00:21.510
it was initially a simpler, lightweight alternative to J2EE.

7
00:21.510 --> 00:24.440
They basically give you a large number of helper classes

8
00:24.440 --> 00:26.913
to make enterprise development easier.

9
00:28.810 --> 00:32.980
But now, you may wonder, well, what about J2EE or Java EE?

10
00:32.980 --> 00:35.960
And here, they have client-side presentation,

11
00:35.960 --> 00:38.040
they talked about server-side presentation

12
00:38.040 --> 00:41.640
with JSP, servlets, XML, and Web Services.

13
00:41.640 --> 00:44.640
They also discussed the idea of server-side business logic

14
00:44.640 --> 00:48.380
using Enterprise JavaBeans, Web Services, and so on.

15
00:48.380 --> 00:50.970
And all talk into a backend database.

16
00:50.970 --> 00:52.880
And this all looks really good on paper

17
00:52.880 --> 00:54.220
and as the developers,

18
00:54.220 --> 00:58.280
we were very excited when we saw this, viewing it on paper,

19
00:58.280 --> 00:59.790
but what happened is that when we actually got

20
00:59.790 --> 01:02.980
into the implementation details, it was another story,

21
01:02.980 --> 01:05.080
and I'll talk more about that in a second.

22
01:07.600 --> 01:09.750
All right, so how did J2EE grow up?

23
01:09.750 --> 01:11.920
Well, in the early days, it started out really nice.

24
01:11.920 --> 01:14.930
You had servlets, JSPs back in 1999.

25
01:14.930 --> 01:18.070
You also had Enterprise JavaBeans, Java Message Service,

26
01:18.070 --> 01:20.130
and RMI, Remote Method Invocation.

27
01:20.130 --> 01:20.963
And then over the years,

28
01:20.963 --> 01:24.050
they added more support for EJB with 1.3.

29
01:24.050 --> 01:28.212
They added, in J2EE 1.4, they added Web Services.

30
01:28.212 --> 01:31.200
In Java EE 5, they kind of renamed it a bit,

31
01:31.200 --> 01:33.020
so it's Java Enterprise Edition 5.

32
01:33.020 --> 01:35.070
They dropped the J2EE thing.

33
01:35.070 --> 01:37.603
And then they added some ease of use for EJB 3,

34
01:38.721 --> 01:42.920
JPA, JSF, JAXB, and JAX-WS or Web Services.

35
01:42.920 --> 01:45.450
And then with EE 6 again, they pruned,

36
01:45.450 --> 01:48.330
meaning they got rid of some stuff that didn't work,

37
01:48.330 --> 01:51.000
mainly some of the EJB problems,

38
01:51.000 --> 01:54.160
and also, they made it easier to use so on and so forth.

39
01:54.160 --> 01:58.173
They had a support for CDI, Context Dependency Injection.

40
01:59.720 --> 02:01.390
And then finally, in Java EE 7,

41
02:01.390 --> 02:03.940
they added support for JMS version two,

42
02:03.940 --> 02:07.490
Batch, Concurrency, Web Sockets, and so on.

43
02:07.490 --> 02:10.920
So, that's kind of how J2EE grew up over time.

44
02:10.920 --> 02:15.100
So, servlets and JSPs were like the initial popular items

45
02:15.100 --> 02:18.193
and then they started adding other things along the way.

46
02:20.200 --> 02:22.040
Now, the one thing they added along the way

47
02:22.040 --> 02:23.980
was Enterprise JavaBeans.

48
02:23.980 --> 02:26.670
And so, EJB is like your cousin

49
02:26.670 --> 02:29.120
or your family member that you just don't really like

50
02:29.120 --> 02:31.740
because they just mess things up for everybody.

51
02:31.740 --> 02:35.290
So, the early versions of Enterprise JavaBeans,

52
02:35.290 --> 02:39.410
versions one and two, were extremely complexly developed.

53
02:39.410 --> 02:43.070
You had to create these XML deployment descriptors.

54
02:43.070 --> 02:46.060
You had to define multiple interfaces.

55
02:46.060 --> 02:48.220
So, like we have on this diagram here,

56
02:48.220 --> 02:52.150
to create a Bean Class, we had to have a Home Interface

57
02:52.150 --> 02:53.990
and then a Component Interface,

58
02:53.990 --> 02:57.200
and you basically had, like, three or three .java files

59
02:57.200 --> 03:00.380
just for an actual Bean implementation.

60
03:00.380 --> 03:01.650
So, just a lot of work.

61
03:01.650 --> 03:03.830
It was really clunky for a developer

62
03:03.830 --> 03:05.850
to write all of this code.

63
03:05.850 --> 03:08.390
It was very tedious and very error prone.

64
03:08.390 --> 03:10.710
But once you've finally got the Bean developed

65
03:10.710 --> 03:13.730
and deployed it, and you deployed it in production,

66
03:13.730 --> 03:17.830
then you are slapped with another problem: poor performance.

67
03:17.830 --> 03:19.690
So, these Entity Beans,

68
03:19.690 --> 03:23.210
basically mappings between Java classes and database tables,

69
03:23.210 --> 03:25.970
ah, just awful slow, just terribly slow.

70
03:25.970 --> 03:27.570
Like, we actually had to do,

71
03:27.570 --> 03:31.460
on one deployment, we actually had to pull our code

72
03:31.460 --> 03:33.300
back out of the production

73
03:33.300 --> 03:35.590
and actually remove the EJB functionality

74
03:35.590 --> 03:38.260
because it slowed everything down.

75
03:38.260 --> 03:41.260
And so, what happened over time is that a lot of developers

76
03:41.260 --> 03:44.500
started to continue to do J2EE

77
03:44.500 --> 03:48.403
but they actually would do it without Enterprise JavaBeans.

78
03:49.650 --> 03:50.860
And so, this kind of caught on

79
03:50.860 --> 03:52.680
with other development teams too

80
03:52.680 --> 03:55.000
and pretty much, a lot of folks are doing it.

81
03:55.000 --> 03:56.960
So, this one fellow, Rod Johnson,

82
03:56.960 --> 03:58.250
he actually wrote this great book

83
03:58.250 --> 04:02.350
called J2EE Development without EJB.

84
04:02.350 --> 04:04.320
So, EJB was very popular at one point,

85
04:04.320 --> 04:06.010
then it fell out of favor.

86
04:06.010 --> 04:07.420
And so, he pushed that out

87
04:07.420 --> 04:09.840
and they also started working on the Spring Framework.

88
04:09.840 --> 04:11.810
And so, they released another book,

89
04:11.810 --> 04:15.180
Java Development with the Spring Framework.

90
04:15.180 --> 04:17.980
So, EJB was kind of like that bad cousin

91
04:17.980 --> 04:20.110
or that bad uncle that you just didn't want in the family

92
04:20.110 --> 04:23.943
because they mess it up for everybody. 