Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
Page
1
(This page has no text content)
Page
2
(This page has no text content)
Page
3
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix CHAPTER 1 How We Got Here: History of Java in a Nutshell . . . . . . . . . . . . . . . . . 1 CHAPTER 2 Getting to Know your IDE: The Secret to Success . . . . . . . . . . . . . . 11 CHAPTER 3 Collaborating Across the Enterprise with Git, Jira, and Confluence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 CHAPTER 4 Automating Your CI/CD Builds with Maven, Gradle, and Jenkins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 CHAPTER 5 Capturing Application State with Logging Frameworks . . . . . . . . . 129 CHAPTER 6 Getting to Know the Spring Framework . . . . . . . . . . . . . . . . . . . . . 163 CHAPTER 7 Testing Your Code with Automated Testing Tools . . . . . . . . . . . . . 195 CHAPTER 8 Annotation Driven Code with Project Lombok . . . . . . . . . . . . . . . . 235 CHAPTER 9 Parallelizing Your Application Using Java Concurrency . . . . . . . . . 249 CHAPTER 10 Pattern Matching with Regular Expressions . . . . . . . . . . . . . . . . . . 283 CHAPTER 11 Coding the Aspect-Oriented Way . . . . . . . . . . . . . . . . . . . . . . . . . . 311 CHAPTER 12 Monitoring Your Applications: Observability in the Java Ecosystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325 CHAPTER 13 Performance Tuning Your Services . . . . . . . . . . . . . . . . . . . . . . . . . . 351 CHAPTER 14 Getting to Know More of the Ecosystem . . . . . . . . . . . . . . . . . . . . 377 APPENDIX Reading and Writing XML, JSON, and YAML . . . . . . . . . . . . . . . . . 395 INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415 REAL- WORLD JAVA®
Page
4
(This page has no text content)
Page
5
Real- World Java®
Page
6
(This page has no text content)
Page
7
Real- World Java® HELPING YOU NAVIGATE THE JAVA ECOSYSTEM Victor Grazi Jeanne Boyarsky
Page
8
Copyright © 2025 by John Wiley & Sons, Inc. All rights, including for text and data mining, AI training, and similar technologies, are reserved. Published by John Wiley & Sons, Inc., Hoboken, New Jersey. Published simultaneously in Canada and the United Kingdom. ISBNs: 9781394275724 (Paperback), 9781394275748 (ePDF), 9781394275731 (ePub) No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per- copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750- 8400, fax (978) 750- 4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748- 6011, fax (201) 748- 6008, or online at www.wiley.com/go/permission. Trademarks: WILEY and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Java is a trademark or registered trademark of Oracle America, Inc. All other trademarks are the property of their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book. Limit of Liability/Disclaimer of Warranty: While the publisher and authors have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation. You should consult with a professional where appropriate. Further, readers should be aware that websites listed in this work may have changed or disappeared between when this work was written and when it is read. Neither the publisher nor authors shall be liable for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other damages. For general information on our other products and services, please contact our Customer Care Department within the United States at (800) 762- 2974, outside the United States at (317) 572- 3993. For product technical support, you can find answers to frequently asked questions or reach us via live chat at https://support.wiley.com. If you believe you’ve found a mistake in this book, please bring it to our attention by emailing our reader support team at wileysupport@wiley.com with the subject line “Possible Book Errata Submission.” Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic formats. For more information about Wiley products, visit our web site at www.wiley.com. Library of Congress Control Number: 2024934523 Cover image: © CSA- Printstock/Getty Images Cover design: Wiley
Page
9
To the Java community for being so open to helping people learn. — Victor & Jeanne
Page
10
(This page has no text content)
Page
11
VICTOR GRAZI is a voracious learner who back in 1996 heard about this new technology called “the Internet” and a new technology called Java that made the Internet blaze! Inducted as a Java champion in 2012, he serves on the Java Community Process Executive Committee, leads a JSR, served as Java Lead Editor on InfoQ maga- zine, and has traveled the world evangelizing Java. He is the author of Java Concurrent Animated, an application that has helped thousands of developers visualize Java concurrency. JEANNE BOYARSKY is excited to be publishing this, her 10th book. She was selected as a Java Champion in 2019 and is a leader of the NYJavaSIG. She has worked as a Java developer for more than 22 years at a bank in New York City where she develops, mentors, and conducts training. Besides being a senior moderator at CodeRanch.com in her free time, she works on the forum code base. Jeanne also mentors the programming division of a FIRST robotics team, where she works with students just getting started with Java. She also speaks at several conferences each year. Jeanne is also a Distinguished Toastmaster and a Scrum Master. You can find out more about Jeanne at https://www.jeanneboyarsky.com. ABOUT THE AUTHORS
Page
12
(This page has no text content)
Page
13
RODRIGO GRACIANO is a seasoned software engineer, Java advocate, and technology leader. He has a BSc in computer science from UNILASALLE, Brazil, and has been working with Java since 2006. In 2011, Rodrigo moved to the United States, where he now lives with his wife, Manuela, and their two sons, Lucas and Theodore. Rodrigo is a senior member and leader of the NYJavaSIG, the New York Java User Group, where he actively contributes to organizing monthly events to promote the Java language and its community. A frequent speaker at tech conferences across South America, the United States, and Europe, Rodrigo shares his passion for software development and Java best practices. Currently, he serves as a director of engineering at BNY. In recognition of his contributions to the Java com- munity, Rodrigo was nominated as a Java Champion in 2022. ABOUT THE TECHNICAL EDITOR
Page
14
(This page has no text content)
Page
15
BARRY BURD is a professor in the Department of Mathematics and Computer Science at Drew University in Madison, New Jersey. He’s a director of the Garden State Java User Group and, along with Jeanne, a leader of the NYJavaSIG. He’s the author of several Java books, including Java For Dummies, soon to be in its 9th edition. His most recent book is Quantum Computing Algorithms published by Packt. In 2020, he was honored to be named a Java Champion. ABOUT THE TECHNICAL PROOFREADER
Page
16
(This page has no text content)
Page
17
We would like to thank numerous individuals for their contributions to this book. Thank you to Patrick Walsh and Archana Pragash for guiding us through the process and making the book better in many ways. Thank you to Rodrigo Graciano for being our technical editor and Barry Burd for being our technical proofreader. They made the book better in so many ways. And a special thank- you to our copy editor Kim Wimpsett for finding subtle errors that everyone (including us!) missed. This book also wouldn’t be possible without many people at Wiley, including Kenyon Brown, Pete Gaughan, Ashirvad Moses, and many others. Victor would personally like to say thank- you to his wife, Victoria, for all the date nights she sacrificed to let me work on this book. He continues to learn from her and be awed by her vision every single day. He also wants to thank his parents, Jack and Claudie Grazi, for all they have invested in him. Finally, he thanks posthumously Dr. Isadore Glaubiger, his math professor way back when at Brooklyn Tech, who inspired him and taught him to think. And a special thanks to Jeanne for her organizational skills and attention to detail. Were it not for Jeanne, he says he never would have made it past page 1. Jeanne would personally like to thank Dani, Janeice, Kim, Norm, Scott, and Shweta during a difficult month that overlapped with book writing. She also wants to thank Scott for his patience as Jeanne worked on two books simultaneously (this one and Oracle Certified Professional Java 21 Developer Study Guide). A big thank- you to Victor for coming up with the idea for the book and being a great co- author in bringing it to life. Finally, Jeanne would like to thank all of the new programmers at CodeRanch.com and FIRST robotics teams FRC 694 and FTC 310/479 for the constant reminders of how new programmers think. ACKNOWLEDGMENTS
Page
18
(This page has no text content)
Page
19
INTRODUCTION xxix CHAPTER 1: HOW WE GOT HERE: HISTORY OF JAVA IN A NUTSHELL 1 Introduction 1 Understanding the Stewardship of Java 2 Differentiating Key Java Versions 4 Coding Generics in Java 5 4 Coding with Functional Programming from Java 8 4 Coding Modules from Java 11 5 Coding Text Blocks and Records from Java 17 6 Learning About Virtual Threads from Java 21 7 Working with Deprecation and Retirement 7 Identifying Renames 8 Changing to Jakarta EE 8 Renaming Certifications 8 Understanding the Principles of Change 8 Further References 9 Summary 9 CHAPTER 2: GETTING TO KNOW YOUR IDE: THE SECRET TO SUCCESS 11 Understanding IDE History 12 Starting a New Project 13 Creating a Project from Scratch 13 Creating a Project from Existing Sources 14 Creating a Project from Version Control 15 Adding a Project to Version Control 15 Adding a Module to an Existing Project 16 Creating a Run Configuration 16 Getting to Know Your Keyboard Shortcuts 18 Navigating Your Codebase 19 Copying and Pasting Shortcuts 20 Reordering Code 20 Using Other Helpful Shortcuts 21 Debugging Your Code 22 Debugging a Program 22 Speeding Up Debugger Performance 24 CONTENTS
Page
20
xviii CoNtENtS Remote Debugging 25 Debugging with Hot Swap 26 Refactoring Your Code 26 Avoiding Duplicate Code 26 Renaming Members 31 Inlining 31 Changing Signatures: Adding and Removing Parameters 32 Exploiting the Editor 32 Automated Reformatting of Code 32 Organizing Imports 32 Reformatting Code 32 Unwrapping 33 Comparing Code 34 Using Column Mode 34 Extending the IDE 35 Peeking at Eclipse 36 Peeking at VS Code 37 Comparing IDEs 39 Further References 40 Summary 40 CHAPTER 3: COLLABORATING ACROSS THE ENTERPRISE WITH GIT, JIRA, AND CONFLUENCE 41 Collaborating with Git 42 Introducing Git Basics 42 Learning Key Concepts 42 Differentiating Commits 43 Displaying Git Status 43 Branching 43 Tagging 43 Merging 44 Reading Git Logs 44 Staging Your Changes 44 Installing Git 45 Understanding Git Workflow by Example 45 Fetching, Merging, and Pulling 51 Playing with Branches 53 Resolving Merge Conflicts 54 Using Pull/Merge Requests 55 Using the Git Log 56 Rebasing 57
The above is a preview of the first 20 pages. Register to read the complete e-book.
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
AI guide
【One-Line Pitch】
A practical field guide to the tools and conventions that surround modern Java development—IDEs, Git workflows, build automation, Spring, and testing—written for developers who know the language but want to work confidently inside real teams and enterprise codebases.
【Book Arc】
- **Opening (~0%–10%)**: Orients you to the book's premise—the Java ecosystem changes constantly, and much of what you'll encounter online is outdated or renamed (Java EE to Jakarta EE, Sun to Oracle certifications). This stage solves the "why is everything I read inconsistent?" problem before any tooling begins.
- **Early (~10%–32%)**: Establishes the daily working environment: IntelliJ as the primary IDE, with comparisons to Eclipse and VS Code, plus debugging, refactoring, and formatting shortcuts. Then moves into Git collaboration—cloning, SSH keys, commits, changelists, pull requests, and the Gitflow branching model.
- **Middle (~32%–48%)**: Turns to build and delivery automation. Maven POM structure, semantic versioning, plugins, and multi-module builds are covered, followed by Gradle's dependency configurations and Groovy/Kotlin build scripts, with CI/CD and Jenkins rounding out the pipeline story.
- **Late (excerpts do not cover ~48%–100% in detail)**: The table of contents signals Spring (properties, profiles, Spring Boot, MVC, Actuator, Security) and automated testing (JUnit, TDD, AssertJ, JUnit Pioneer, mocking). The excerpts themselves stop before these chapters' substance.
- **Ending (excerpts do not cover)**: Presumably consolidates the toolchain into an end-to-end picture of enterprise Java practice; the sampled material does not describe the closing chapters.
【Book Arc】 (progression note)
The book follows a deliberate fundamentals-to-practice path: understand the ecosystem's churn, set up your tools, learn to collaborate, automate your builds, then apply frameworks and tests. Each stage assumes the previous one.
【Key Takeaways】
- **The ecosystem's churn is the real subject** (Opening): Java EE became Jakarta EE with the `javax`→`jakarta` package rename, and Sun certifications were rebranded under Oracle. Knowing this history lets you judge whether older tutorials and résumé credentials are still meaningful—a framing device the book returns to.
- **IDE fluency is treated as a professional skill, not a preference** (Early): IntelliJ gets deep coverage—run configurations, multi-module projects, debugger performance tuning, import optimization, and reformatting—while Eclipse and VS Code are mapped through a terminology table (module/workspace, project/folder, plugin/extension) so you can read across teams.
- **Git knowledge is framed around team constraints** (Early): Beyond cloning and committing, the book addresses enterprise realities like SSH-key authentication, protected branches requiring pull requests (merge requests in GitLab), and changelists for separating work—practical friction points rather than Git trivia.
- **Gitflow is presented as a concrete branch discipline** (Early): A long-lived `develop` branch, short-lived `feature/` branches named after Jira keys, merges back to `develop`, and build-server validation on every commit—showing how branching conventions tie into issue tracking and CI.
- **Build tools are explained through their configuration model** (Middle): Maven's POM, GAV coordinates, properties, and plugin documentation patterns are demystified, alongside semantic versioning (major/minor/patch, SNAPSHOT suffixes, sub-1.0.0 as prerelease) so version numbers become readable signals.
- **Gradle is contrasted with Maven at the dependency level** (Middle): Dependency configurations (`implementation`, `testImplementation`, `compileOnly`, `runtimeOnly`) and the fact that build files are Groovy or Kotlin code—enabling variables and string interpolation—illustrate Gradle's programmatic flexibility versus Maven's declarative conventions.
- **Collaboration tooling extends past code** (Middle): Jira for process and Confluence for knowledge management are grouped with Git as "enterprise collaboration" essentials, signaling that the book cares about how teams work, not just how code compiles.
- **Testing and Spring are positioned as the applied layer** (Late): The contents promise JUnit configuration in both Maven and Gradle, TDD, assertions, parameterized tests, and Spring Boot via Initializr—but the excerpts do not cover their content, so treat these as signposts, not summaries.
【Reading Tips】
- **Skim the ecosystem-history chapter if you're already employed in Java**; deep-read it if you're self-taught or returning after years away, since the Jakarta rename and certification rebranding cause real confusion.
- **Use the IDE comparison tables as a translation layer**, not a tutorial. If your team uses Eclipse or VS Code, read the IntelliJ sections for concepts and the comparison tables for vocabulary.
- **Deep-read the Git and build-tool chapters**—these are where the book is most concrete, with named shortcuts, file structures, and workflow steps you can apply the same day.
- **Treat Spring and testing chapters as guided labs**: the companion code at the referenced GitHub repository is essential; reading without running the examples will undersell these sections.
- **Watch for version-sensitive details**: shortcuts, plugin names, and tooling UIs age quickly; verify against current documentation when something doesn't match.
【Coverage Limits】
This guide is based on stratified excerpts covering roughly the first half of the book (ecosystem context, IDEs, Git, Maven/Gradle/CI-CD); the Spring and testing chapters are known only from the table of contents, so their treatment here is indicative rather than substantive.
Passage locations
Page 17
a great co-a uthor in bringing it to life. Finally, Jeanne would like to thank all of the new programmers at CodeRanch.com and FIRST robotics teams FRC 694 a...
View in text
Excerpt 2
CHAPTER 2 GettinG to Know your iDe: the Secret to SucceSS Changing Signatures: Adding and Removing Parameters You will frequently find methods where argument...
View in text
Excerpt 3
ant to keep some files out of your commit for now, you can create a new changelist and move those files to that changelist to separate your commits. FIGURE 3...
View in text
Excerpt 4
ies, using a bill of materials, and releasing your project. Setting System Properties Java system properties are optional command-l ine arguments that change...
View in text
Recommended for You
{{#thumbnailUrl}}
{{/thumbnailUrl}}
{{^thumbnailUrl}}
{{/thumbnailUrl}}
Loading recommended books...
Failed to load, please try again later
Tip the Site
Scan the WeChat Pay or Alipay code to tip. No login required.
WeChat Pay
Alipay