Abstract
It seems appropriate to start learning about Spring by building out our first example as a simple "Hello, World!" application. In this chapter, we’re going to take a look at the tools and libraries we’re going to rely on – in particular, Gradle and TestNG – and build a simple application to demonstrate how we validate that our application works as designed. Then – at last – we’ll leverage Spring in our application. This way, we’ll establish the knowledge we’ll need to make sense of the rest of the book.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Why TestNG and not JUnit? There’s a little more explanation later in this chapter, but just to get it out of the way: TestNG makes certain kinds of tests more convenient. You should be able to use JUnit instead with fairly little difficulty, although you’ll need to add a JUnit module to use features like data providers.
- 2.
We’re foisting a “Hello world” on you, but we promise there’s no “Pet Store” in this book. If that doesn’t give you a palpable sense of relief, well… pretend it does, because it should. Right, Joe? We’re not doing the Pet Store, right? We agreed? Yes?
- 3.
If you don’t write tests, you need to start writing tests. Don’t worry, you’ll get a ton of exposure in this book. They’re easy and fun. After your first 1,203,172 tests, you might get a free toaster.
- 4.
Kernighan, Brian & Ritchie, Dennis (1978), Englewood Cliffs, NJ; Prentice-Hall.
- 5.
Gradle can be found at https://gradle.org . We’ll demonstrate how to install Gradle for many operating systems as we go through the chapter.
- 6.
If your operating system is not addressed, fear not, Brave Reader: http://gradle.org/ can help.
- 7.
SDKMAN! ( https://sdkman.io/ ) is a developer-focused environment manager for multiple operating systems, including Linux, Windows, and OSX. It allows you to have localized environments for building and running applications. It’s horribly useful, because it disassociates you from the distribution’s package-management process.
- 8.
Homebrew ( https://brew.sh/ ) is essential if you run MacOS, so if you don’t have it installed already, for the love of all that is good and holy, do it now.
- 9.
Scoop ( https://scoop.sh/ ) is a simple command line installer for Windows.
- 10.
TestNG utilized the concept of data providers before JUnit did, and while JUnit supports the feature now it’s through a library external to JUnit. We’ve chosen to stick with TestNG, but you can certainly use JUnit instead without hurting our feelings very much; JUnit’s nearly caught up with TestNG and in some ways has surpassed it.
- 11.
Using static imports in your regular code is a code smell, and you don’t want your code to smell funky, do you? … No, you don’t.
- 12.
We’ll be showing you programmatic Spring context configuration in Chapter 3.
- 13.
Worth noting: Not remembering the proper inheritance bit the author for about 30 minutes before he realized that he’d forgotten the required class hierarchy.
- 14.
I promise the next chapter will fly by, configuration talk is super exciting.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Joseph B. Ottinger and Andrew Lombardi
About this chapter
Cite this chapter
Ottinger, J.B., Lombardi, A. (2019). Hello, World!. In: Beginning Spring 5. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4486-9_2
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4486-9_2
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4485-2
Online ISBN: 978-1-4842-4486-9
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)