1
00:00:01,780 --> 00:00:05,810
Welcome back! In this step, we would look at starters.

2
00:00:06,080 --> 00:00:12,560
We would look at a couple of example starters. Spring Boot starter web and Spring Boot starter JPA.

3
00:00:12,780 --> 00:00:18,030
If you open up the pom dot xml  of the project that we have created earlier, you would see

4
00:00:18,030 --> 00:00:20,620
that it's using Spring Boot starter web.

5
00:00:20,700 --> 00:00:23,950
How did it use Spring Boot starter web?

6
00:00:24,030 --> 00:00:28,240
That's because we configured a dependency on web in here.

7
00:00:28,440 --> 00:00:36,570
So if I open that up and go to the pom dot xml, youd see that Spring Boot starter web is configured in

8
00:00:36,580 --> 00:00:37,190
here.

9
00:00:37,420 --> 00:00:42,820
So this Spring Boot starter web is the preferred stater for Spring Boot to develope web applications

10
00:00:43,210 --> 00:00:46,350
as well as RESTful web services.

11
00:00:46,360 --> 00:00:53,680
So if I go control and hover over it or command and hover over it and click open pom dot xml for Spring Boot

12
00:00:53,680 --> 00:01:00,140
starter web you would see that it defines varied kind of dependencies.

13
00:01:00,170 --> 00:01:01,710
So what does it really define?

14
00:01:01,870 --> 00:01:09,910
Let's look at it. When we run the application, we were automatically using Tomcat. Thats because of this Spring Boot

15
00:01:10,580 --> 00:01:11,140
starter Tomcat.

16
00:01:11,560 --> 00:01:13,390
If you look at Spring Boot starter web,

17
00:01:13,540 --> 00:01:16,720
it contains a dependency on Spring Boot

18
00:01:16,740 --> 00:01:22,640
starter Tomcat and that's how the application is automatically running in

19
00:01:22,660 --> 00:01:30,260
Tomcat. The other things which you would seen here are Spring web and Spring web MVC. Spring MVC

20
00:01:30,260 --> 00:01:37,090
as you would know is this Spring MVC framework. If I add in a Spring Boot starter web, I automatically get Spring

21
00:01:37,090 --> 00:01:40,730
MVC, I automatically get validation. Validation -

22
00:01:40,750 --> 00:01:45,850
the default implementation for Java validation API is hibernate validator.

23
00:01:45,850 --> 00:01:49,810
So I get that as well and I get Tomcat.

24
00:01:50,020 --> 00:01:57,200
And, also I get the starter JSON. Starter JSON is more for RESTful web services.

25
00:01:57,280 --> 00:02:05,320
We saw that when we actually invoke the RESTful web service, the conversion to JSON automatically happen. If

26
00:02:05,320 --> 00:02:07,030
you actually looked at our code,

27
00:02:07,180 --> 00:02:12,550
We just returned the bean back. So in the booksController, what we're doing is we are just returning a

28
00:02:12,550 --> 00:02:13,960
list of beans back.

29
00:02:13,960 --> 00:02:19,710
How does it automatically convert it to JSON? That's done through this starter.

30
00:02:19,950 --> 00:02:25,000
The starter JSON brings in the JSON into the picture.

31
00:02:25,000 --> 00:02:32,590
Basically when you look at all starter projects, they have a set of dependencies that are already defined.

32
00:02:32,980 --> 00:02:37,900
And these dependencies are automatically provided to our project.

33
00:02:37,900 --> 00:02:44,590
So when I add in Spring Boot starter web, I get all these dependencies. So you'd see that I'm getting

34
00:02:44,620 --> 00:02:49,030
Jackson for handling all the JSON stuff. You'd see that I'm getting Tomcat.

35
00:02:49,030 --> 00:02:56,280
So that I can the application in Tomcat. I'm getting hibernate validator and validation API for doing the validation.

36
00:02:56,320 --> 00:03:03,430
Im getting this Spring framework because I have a dependency on Spring web and that could have dependency

37
00:03:03,430 --> 00:03:05,140
on Spring framework.

38
00:03:05,560 --> 00:03:14,400
And, also I would get the logging frameworks as well because the logging frameworks are by default defined

39
00:03:14,460 --> 00:03:15,810
in the Spring Boot

40
00:03:15,870 --> 00:03:20,250
starter. So Spring Boot starter is one of the dependencies in Spring Boot starter web.

41
00:03:20,530 --> 00:03:22,960
So if you open up the pom dot xml for it,

42
00:03:22,990 --> 00:03:25,680
So this is the default starter.

43
00:03:25,780 --> 00:03:32,590
This is where everything inherits from. So any starter that you would use in Spring Boot, it inherits from

44
00:03:32,590 --> 00:03:37,480
Spring Boot starter and you would see that these are the dependency and Spring Boot framework.

45
00:03:37,490 --> 00:03:39,990
This has a dependency on Spring Boot auto configure.

46
00:03:40,150 --> 00:03:42,260
That's how we get auto configuration.

47
00:03:42,280 --> 00:03:46,260
This has a dependency on Spring Boot starter logging.

48
00:03:46,360 --> 00:03:47,840
That's how we would get logging.

49
00:03:47,950 --> 00:03:52,120
And we have a dependency on Spring core as well.

50
00:03:52,210 --> 00:03:56,160
YML is one of the configuration languages that Spring Boot supports.

51
00:03:56,170 --> 00:03:58,930
So we also have snake YML in here.

52
00:03:59,020 --> 00:04:05,660
Thing about Spring Boot starter web is once it brings in all these dependencies, what would kick in? Auto

53
00:04:05,710 --> 00:04:07,150
configuration would kick in.

54
00:04:07,150 --> 00:04:12,640
Because the spring web MVC contains dispatcher servlet. So automatically dispatcher servlet would

55
00:04:12,640 --> 00:04:14,280
be configured.

56
00:04:14,280 --> 00:04:20,230
That's done by the Spring Boot auto configure. Thats the auto configuration which we talked about earlier.

57
00:04:20,950 --> 00:04:25,890
Spring Boot starter web is one of the starter. The other starter you can see in here is Spring Boot starter

58
00:04:25,980 --> 00:04:32,050
test. Spring Boot starter test enables you to write unit test and integration tests as well.

59
00:04:32,380 --> 00:04:38,660
So if I go to the pom dot xml in here, you would see that it has a definition on spring boot test.

60
00:04:38,860 --> 00:04:46,030
It has a definition on the auto configured for Spring Boot test and it has dependencies on Junit framework.

61
00:04:46,500 --> 00:04:47,530
AssertJ.

62
00:04:47,590 --> 00:04:54,870
And also you have Mockito. Mockito is the default mocking framework that comes along with Spring Boot.

63
00:04:54,880 --> 00:05:00,040
A combination of AssertJ and Hamcrest are awesome to write great matches.

64
00:05:00,100 --> 00:05:05,080
And you also have a dependency on the spring test framework which is useful in writing unit tests for

65
00:05:05,080 --> 00:05:05,980
spring.

66
00:05:05,990 --> 00:05:11,500
So until we looked at a couple of starters which are Spring Boot starter web and Spring Boot starter

67
00:05:11,540 --> 00:05:12,270
test.

68
00:05:12,430 --> 00:05:18,520
Other than that, another important starter which is frequently used as a Spring Boot starter JPA.

69
00:05:18,580 --> 00:05:28,570
If you know JPA, JPA is kind of the interface for hibernate. So JPA defines how ORM applications or ORM frameworks

70
00:05:28,690 --> 00:05:36,530
should work. ORM is object relational mapping. Let's now add in a dependency on Spring Boot starter JPA. You

71
00:05:36,530 --> 00:05:40,300
would see now that there would be a lot more Maven dependence which would come in.

72
00:05:40,310 --> 00:05:42,600
Actually, it's Spring Boot starter

73
00:05:45,560 --> 00:05:45,920
data JPA.

74
00:05:46,040 --> 00:05:53,120
So now we have hibernate core, hiberante JPA. We have javax transaction api, hibernate common annotations.

75
00:05:53,210 --> 00:06:00,530
You have spring data, spring data JPA, spring ORM, spring tx and a lot of such dependencies

76
00:06:00,690 --> 00:06:05,310
come in. That's because of the Spring Boot starter JPA.

77
00:06:05,450 --> 00:06:11,480
So if you open up the pom dot xml for spring boot starter JPA then you would see all of the dependencies

78
00:06:11,480 --> 00:06:17,540
that are listed down. So this has a dependency on spring boot starter AOP, starter JDBC, hiberante transaction

79
00:06:17,570 --> 00:06:19,920
API and spring data JPA.

80
00:06:19,940 --> 00:06:26,150
So all this jars you'd get. As soon as I add in a spring starter data JPA, I would get all these

81
00:06:26,360 --> 00:06:27,590
things for free.

82
00:06:27,590 --> 00:06:33,260
One of the things you need to remember is if you are a starting programmer or this is the first time

83
00:06:33,260 --> 00:06:39,470
you are looking at Spring Boot, a lot of things might be confusing to you. Especially because we are referring

84
00:06:39,470 --> 00:06:42,110
to so many different terminologies.

85
00:06:42,260 --> 00:06:49,190
Spring Boot solves problems for wide variety of frameworks. So there are a lot of terminologies that

86
00:06:49,190 --> 00:06:51,830
come into picture when we talk about spring boot.

87
00:06:51,830 --> 00:06:56,570
So if you're not able to understand any of these terminologies do not worry at all.

88
00:06:56,760 --> 00:07:03,200
Over the course of this course and also over the course of your next few years, you'll learn sufficiently

89
00:07:03,200 --> 00:07:07,490
enough so that those terminologies become really clear for you.

90
00:07:07,550 --> 00:07:13,250
The idea for you is to understand the big picture of what Spring Boot does.

91
00:07:13,310 --> 00:07:18,080
Spring Boot is now one of the most popular frameworks to develop.

92
00:07:18,140 --> 00:07:25,220
micro services. The idea behind the whole set of these steps is to give you a flavor of Spring Boot in

93
00:07:25,220 --> 00:07:27,560
a wide variety of scenarios.

94
00:07:27,560 --> 00:07:31,570
If you are not able to understand a couple of scenarios that's not a problem at all.

95
00:07:31,610 --> 00:07:34,170
With that disclaimer, let's end this step here.

96
00:07:34,250 --> 00:07:37,180
And I look forward to see you in the next step.

