For online information and ordering of these and other Manning books, please visit www.manning.com. The publisher offers discounts on these books when ordered in quantity.
Manning Publications Co.
2021 by Manning Publications Co. All rights reserved.
No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.
Recognizing the importance of preserving what has been written, it is Mannings policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.
front matter
foreword
Born as an alternative to EJBs in the early 2000s, the Spring framework quickly overtook its opponent with the simplicity of its programming model, the variety of its features, and its third-party library integrations. The Spring ecosystem grew over the years into the broadest and most mature development framework available in any programming language. Its main competitor quit the race when Oracle stopped the evolution of Java EE 8, and the community took over its maintenance via Jakarta EE.
According to recent surveys ( http://mng.bz/l9VB and http://mng.bz/B1Ar ), Spring is the framework underlying more than half of the Java applications. This fact builds up an enormous codebase that makes it critical for any Java developer to learn Spring, as its inevitable youll encounter this technology in your career. Ive been developing applications with Spring for 15 years, and today the teams that I train in hundreds of companies are almost all using Spring.
The reality is that despite being so popular, its pretty hard to find quality introductory material. The reference documentation is thousands of pages long, describing all the subtleties and details that could be helpful in very specific scenarios, so its not an option for a newcomer. While online videos and tutorials typically fail to engage the student, very few books capture the essence of Spring framework, often spending long pages debating topics that prove to be irrelevant to the problems faced in modern application development. With this book, however, its very hard to find anything to remove; all the concepts covered are recurring topics in the development of any Spring application.
The reader is gently brought to a level sufficient to become rapidly productive in a project based on the Spring framework. My own experience training thousands of employees showed me that the vast majority of developers working with Spring today dont see the ideas as clearly as this book paints them. Furthermore, developers are unaware of the many pitfalls about which this book warns its readers. In my opinion, this book is a must-read for any developer starting on their first Spring project.
The attention with which Laureniu anticipates the typical questions occurring in the readers mind proves his extensive experience teaching Spring in class. This teaching fluency allows the author to adopt a personal, warm tone that makes this book an effortless and pleasant read. The book has a clear, sharp structure, and I really loved how complex topics were progressively revealed and explained and reiterated in subsequent chapters.
This book shines in that the reader is also introduced to fundamental concerns regarding a legacy project using the Spring framework. In an ecosystem dominated by Spring Boot, I find it very useful to sneak a peek under the hood. On the other end, the book also gently introduces the reader to last-generation technologies, like Feign clients and even reactive programming.
I wish you a pleasant reading, and never hesitate to get your hands dirty with some code whenever you think things get complicated.
Victor Rentea
Java champion, trainer, and consultant
preface
Sharing knowledge and creating learning material is a hobby for me. In addition to being a software developer, Im also a teacher. As a Java trainer since 2009, Ive taught Java to thousands of developers with various levels of experience, from university students to experienced developers in large corporations. In the past few years, Ive come to consider Spring a must-learn for beginners. Apps today are no longer implemented with vanilla languagesalmost everything relies on frameworks. Since Spring is the most popular application framework in the Java world today, Spring is something a developer needs to learn in their first software development steps.
In teaching Spring to beginners, Ive realized that it is still treated as something you learn only when you already have some experience coding. When I started writing Spring Start Here, there were already plenty of tutorials, books, and articles on the topic, but my students continued to tell me they found those materials hard to understand. I realized the problem was not that the existing learning material wasnt excellent, but that there was no dedicated study guide for an absolute beginner, so I decided to write a book that doesnt consider Spring something you learn after you have some experience, but instead something you can learn with minimal foundational knowledge.
Technology changes quickly. But its not only the technology changing. We also need to consider how we can improve the way we teach these technologies. Some years ago, one would start learning the language fundamentals and get employed as a developer without even knowing what a framework is. But today, these things are different. Learning all the details of a language up-front is no longer the way to quickly develop the skills you need to work in a software development team. Now, I recommend developers start with the fundamentals and, once they feel comfortable with the basics, start learning an application framework. Spring is, in my opinion, the best application framework to start learning. Understanding the Spring basics also opens doors to learning other technologies and changes the old, linear learning approach into something that looks more like a treeand each branch of the tree is a new framework you learn in parallel with others.