The Insider's Guide to the Java Web Developer Nanodegree - 2
Written by Nikos Vaggalis   
Monday, 10 August 2020
Article Index
The Insider's Guide to the Java Web Developer Nanodegree - 2
Added Value of Mentoring, Quizzes and Final Review

I Programmer team member Nikos Vaggalis enrolled in the inaugural sessions of Udacity's new Java Web Developer Nanodegree program and is charting his progress through this adventure of coding and learning. This second installment is on Spring Boot Basics..

Having already gained one Udacity Nanodegree, an experience I documented in my 7-part Insider's Guide To Udacity Android Developer Nanodegree, I signed up to the new Java Web Developer Nanodegree with a fairly good idea of what to expect. The idea of this series is to share what it's really like and in this installment I look at the course content for Chapter 2, Spring Boot Basics, which students tackle straight after the introductory material in the first month of this four-month program. I’m going into quite a lot of detail so that you can appreciate the depth that this program achieves.

Spring Boot Basics is comprised of the following lessons:

Lesson 1 - Introduction to Spring Boot

Lesson 2 - Web Development in Java

Lesson 3 - Spring Boot Basics for Web Development

Lesson 4 - Spring MVC and Thymeleaf

Lesson 5 - Data Persistence & Security

Lesson 6 - Testing

Project: -  SuperDuperDrive

Lesson 2 - Web Development in Java covers many fundamental subjects in order to better understand the Spring ecosystem and generally web development under Java. In it we find the role Java Application Servers play in web development in parsing and routing HTTP requests to our MVC applications through the common interface of the Servlet.Spring. On top of that, there's material on Security, Database Access and HTML generation.

There are many Java application servers, ranging from GlassFish, Netty, WildFly to the heavyweight Weblogic and to the venerable Tomcat. The intuition here is that Spring Boot encapsulates an embedded Tomcat server so that you can instantly run and test your application on your machine locally (run from within your IDE) before opting to export the packaged application to run on a standalone server.

We also find that Spring is compartmentalized; when some functionality is needed, you can pick and import the related module as a maven dependency .pom file. So all parts of the framework such as Spring MVC, Thymeleaf, Spring Security, come as modules. Even the embedded Tomcat server is imported as a module itself!

Spring Boot makes managing those dependencies even easier by providing the starter packs, which are preconfigured bundles of dependencies. By importing spring-boot-starter-parent and then for instance spring-boot-starter-web and spring-boot-starter-thymeleaf, Spring instantly imports dozens of interdependent modules so that you don't have to go through each one by hand. Furthermore, this way you don't even have to specify which versions to import; it is handled automatically depending on spring-boot-parent's version.

After this insightful introduction, we are ready to kickstart our first demo application. This is easy when using Spring Initializr, a helpful webpage for generating starter projects.

At this point, our task list looks like:

 

  • Navigate to https://start.spring.io in your browser.

  • Select a group, artifact, and name of your choice. For example, you could set the group to `com.udacity.jdnd` and have your project named course1.

  • Add the dependency Spring Web.

  • Click the ‘Generate’ button at the bottom of the page to download the project. Extract it to the location you want your project.

  • Open IntelliJ IDEA.

  • From the File menu, select Open and then navigate to the location you extracted your project.

  • In the Project structure pane, navigate to the only class in the project. If you used the names above, this will be `com.udacity.jdnd.course1.Course1Application.java`.

  • Right click this class and run it. This should launch the application. 

To sum up, in Lesson 2 we've learned a lot of fundamental concepts:

Web servers

Java application servers

Spring framework

Spring Boot

Spring Initializr

and got our head around Spring's architecture, which is crucial to comprehend in order to write efficient code later on.

udacityLogoNew



Last Updated ( Monday, 10 August 2020 )