This tutorial shows two standard Java approaches for loading a jdbc.properties file: using ClassLoader.getResourceAsStream with Properties, and using ResourceBundle.getBundle, each with complete code examples and output verification.
The article explains how Java source code is compiled into bytecode, how class loaders (including the bootstrap, extension, application, and custom loaders) load and verify classes using the parent‑delegation model, and how encryption, obfuscation, and decompilation tools affect code protection and debugging.
This article walks through the full lifecycle of a Java class—from loading, verification, preparation, and resolution to initialization, usage, and unloading—explains active versus passive references, the parent‑delegation model, JDK 8‑to‑17 module‑system changes, and shows how to write a custom ClassLoader for class isolation.
The article examines six practical situations—SPI, Tomcat WebAppClassLoader, OSGi bundles, JDBC driver loading, custom ClassLoaders, and Java agents—where Java’s default parent‑delegation class‑loading mechanism is intentionally bypassed, explaining the motivations, implementations, and associated risks of each approach.
This article explains Java's Service Provider Interface (SPI), compares it with traditional APIs, and provides a step‑by‑step guide to create a multi‑module Maven project, custom class loader, and Spring Boot application that dynamically loads authentication plugins from external JARs.
This article explains the purpose, behavior, return values, and exception handling of Java's Class.forName and ClassLoader APIs, compares their initialization and flexibility characteristics, and provides practical code examples and typical use cases for each approach.
This article dissects the SpringBoot class‑loading mechanism, explaining how the JVM parent‑delegation model is selectively overridden with custom class loaders like LaunchedURLClassLoader and RestartClassLoader, and how these changes integrate with Spring's bean lifecycle, auto‑configuration, and practical troubleshooting techniques.
This guide explains Java's Service Provider Interface (SPI), contrasts it with traditional APIs, and walks through creating a multi‑module Maven project that uses SPI, a custom class loader, and external JAR loading to implement a flexible authentication plugin in a Spring Boot application.
This article explains why Java bytecode is vulnerable to decompilation and presents a comprehensive set of protection methods—including isolation, class encryption, native code conversion, and various obfuscation techniques—illustrated with diagrams and a real‑world case study.
This article guides job seekers through the autumn recruitment season, highlights bank hiring timelines and English requirements, and then provides a comprehensive Java interview Q&A covering JVM memory structures, object allocation failures, the parent‑delegation model, message‑queue usage, Spring AOP principles, and database string type differences.
This article explains a step‑by‑step approach to load external JAR files into the JVM, configure Spring Boot to recognize the new classes, and choose among classpath expansion, Spring Boot's loader.path, or a custom ClassLoader, complete with Maven settings and code examples.
This article presents nine practical methods for loading files from the resources directory in a Spring Boot project, covering ClassLoader, Class, Spring ResourceLoader, ResourceUtils, ApplicationContext, ServletContext, Java IO, NIO, and ClassPathResource approaches.
This guide explains two straightforward steps to load external JAR files into the JVM and make Spring Boot scan them, covering three implementation options—extending the classpath, using Spring Boot’s loader.path parameter, and creating a custom classloader—along with configuration details, Maven settings, and runtime considerations.
This article explains Java's ClassLoader architecture, the parent delegation model, the three phases of class loading, dynamic loading and binding mechanisms, and demonstrates how to inspect object layout using the JOL tool, providing code examples and practical insights for JVM internals.
This article compares the compilation and runtime processes of C and Java programs, explains Java's class loading, linking, initialization, memory layout, execution engine components, and native interface, and highlights why Java startup is slower than native C execution.
This article explains Java annotations—including built‑in, meta‑ and custom annotations—covers how they are used in Spring, describes the Java reflection mechanism, class loading process, ways to obtain Class objects, and demonstrates retrieving generic and annotation information at runtime with code examples.
This article explains why Java introduced the Context ClassLoader to bypass the parent‑delegation model, how it enables SPI mechanisms such as JDBC drivers, and the specific class‑loading pitfalls encountered when running Spring Boot applications as executable JARs.
This article explains Java's dynamic ClassLoader mechanism, outlines the hierarchy of built‑in loaders, details frequent problems such as ClassNotFoundException, NoClassDefFoundError, ClassCastException and version conflicts, and provides practical troubleshooting steps and best‑practice recommendations for reliable class loading.
This article explains how the java.lang.ClassLoader#loadClass() API works, why frequent concurrent calls can cause thread blocking due to internal synchronization, demonstrates the issue with a sample multithreaded program, analyzes thread‑dump data, and provides practical solutions to mitigate the performance problem.
By using the JavaCompiler API to compile source files at runtime together with a custom ClassLoader that loads the generated bytecode, developers can hot‑reload changed classes instantly without restarting the JVM, enabling rapid iteration, plugin‑style extensions, and faster development cycles.
This article demonstrates how to use Byteman’s DO execution module on the Chaos Mesh platform to invoke static or instance methods of external Java classes without modifying the original code, covering reflection, ClassLoader tricks, and a complete BTM rule example.
This article explains how to make custom classes visible to Spring Boot by loading external JAR files through four methods—extending the classpath, using Spring Boot's loader.path parameter, creating a custom ClassLoader, and modifying the boot classpath—while also showing how to configure scanning and packaging details.
This article explains Java's ClassLoader mechanism, its loading, linking, and initialization phases, the parent‑delegation hierarchy, common problems such as ClassNotFoundException and OOM, and provides practical troubleshooting steps and best practices for managing dynamic class loading.
This article explains how Byteman's IMPORT declaration lets developers explicitly reference classes across modules, handling classloader scopes, providing code examples, key points, and plugin support for various Java module systems.
This article explains how to create custom Java class loaders by extending java.lang.ClassLoader, when to override findClass versus loadClass, demonstrates both adhering to and breaking the parent delegation model with complete code examples, and discusses common scenarios such as web servers, SPI, and hot deployment where the delegation mechanism is intentionally altered.
This article explains Java's class loading mechanism, the three built‑in class loaders, the parent‑delegation model, reasons for using it, how to create custom loaders, and the detailed phases of loading, linking, initialization, usage, and unloading.
This article explains Java's reflection mechanisms, comparing Class.forName and ClassLoader as two primary ways to load classes, detailing their behavior, static initialization effects, code examples, and practical scenarios such as loading JDBC drivers versus custom dynamic loading.
This article demonstrates a practical approach to protect sensitive Spring Boot applications by encrypting the JAR with AES, storing the key in a secure vault, and using a custom ClassLoader to decrypt and load classes at runtime, while highlighting key management, performance, and additional hardening considerations.
This article explores Java's class loading mechanism in depth, covering when and how classes are loaded, the parent‑delegation model, the internal role of ClassFileParser and InstanceKlass, parallel loading nuances, and practical ways to break or extend the delegation chain with custom class loaders.
This article provides a comprehensive guide on dynamically loading JAR packages in Spring Boot, covering core concepts, benefits, and step‑by‑step implementations using SpringBootClassLoader and third‑party OSGi libraries, complete with practical code examples.
This article explains the purpose of Java's parent‑delegation class‑loading mechanism, describes its three built‑in loaders, shows how custom loaders can override it, and explores common situations—such as JNDI, JDBC, Tomcat, and OSGi—where developers intentionally break the delegation for flexibility and modularity.
By implementing a plug‑in architecture that uses a custom URLClassLoader to load and unload JAR‑packaged governance tasks at runtime, the Spring Boot application can dynamically register Spring beans and XXL‑Job handlers, remove them cleanly, update configuration via YAML or Nacos, and package the solution with Maven Shade without restarting services.
After upgrading from Tomcat 7 to Tomcat 8, the application’s mixed log4j‑1.4 and logback‑1.2.3 dependencies caused the SLF4J binder to be loaded nondeterministically, so Tomcat 8 sometimes selected the Log4j binder without a configuration file, resulting in completely missing log output; removing the conflicting jars or enforcing a deterministic class‑loading order restored logging.
After upgrading to JDK 11, a FastJSON serialization bug caused the amount field in Money objects to disappear, leading to failed refunds; this article details the investigation, from classloader quirks and ASM handling to dependency conflicts and the ultimate fix of removing a problematic jar.
The article explains Java's parent delegation model for class loaders, its benefits for stability and security, how to break it by customizing loadClass or using thread‑context class loaders, and illustrates common scenarios such as JNDI, JDBC and Tomcat's own class‑loader hierarchy.
This article explains the purpose of Java's parent delegation class‑loader mechanism, describes its three built‑in loaders, and details common scenarios—such as JNDI, JDBC, Tomcat, and OSGi—where developers intentionally break the delegation to achieve flexibility and isolation.
This article explains how to design a plug‑in architecture for a data‑governance service by using a custom URLClassLoader, Spring bean registration, and XXL‑Job integration to dynamically load, start, stop, upgrade, and unload individual governance tasks without restarting the whole service, and also shows how to persist the configuration in local YAML or Nacos.
This article explains the concepts and step-by-step implementation of dynamically loading JAR packages in Spring Boot applications, covering built‑in classloader usage, creating JARs, and leveraging third‑party libraries to enhance flexibility and extensibility.
This article examines the Matrix middle‑platform framework used at JD.com, detailing its hot‑deployment mechanism, the push‑and‑pull integration chains, class‑loader isolation based on the parent‑delegation model, and the design of business‑identity recognition, while offering best‑practice recommendations and code examples.
This article explains how to design a plug‑in architecture for a data‑governance service that can start, stop, add, or upgrade individual tasks at runtime without restarting the whole service, using a custom URLClassLoader, Spring bean registration, XXL‑Job integration, dynamic configuration updates, and a clean unload process.
This article examines JD's practical implementation of middle‑platform (中台) evolution, detailing the design rationale, the Matrix support framework, hot‑deployment mechanisms, class‑loader isolation, and business‑identity principles to illustrate how the architecture improves delivery speed and modularity.
This guide explains Android pluginization, showing how a host app can dynamically load separate APK modules—including native libraries, classes via a custom DexClassLoader, and mixed resources—while supporting hot updates, modular isolation, and reduced initial size, and details each loading step and manager implementation.
The article details a high‑performance, high‑stability Android code‑coverage technique that creates a surrogate ClassLoader, copies the target PathClassLoader’s private classTable pointer, and invokes findLoadedClass on this loader to query a class’s load state without triggering Android’s native optimization that would otherwise automatically load the class.
The solution introduces a plug‑in architecture that uses a custom URLClassLoader to load governance task JARs at runtime, registers their Spring beans and @XxlJob handlers with XXL‑Job, and provides unload logic to deregister jobs, destroy beans, and update configuration via YAML or Nacos without restarting the service.
A Java developer added fastjson to a SkyWalking agent for JSON conversion, causing class‑loading conflicts in a SpringBoot 2 application; the article analyzes the root cause, demonstrates debugging steps, explains the parent‑delegation mechanism, and presents solutions using Maven shade relocation or switching to Gson, with practical lessons for avoiding similar issues.
This article analyzes how adding Fastjson to a SpringBoot agent causes classloader conflicts that prevent GenericHttpMessageConverter from loading, explains the underlying parent‑delegation mechanism, and presents solutions such as using Maven Shade to rename packages or switching to a lightweight JSON library like Gson.
This article provides a concise yet comprehensive overview of the Java Virtual Machine, covering its core components, how Java source files are compiled and executed, class‑loader mechanisms, runtime memory areas, garbage‑collection algorithms, and practical JVM tuning parameters for optimal performance.
This article explains how Java's dynamic compilation can be applied to modularize and simplify code management in large projects, demonstrates a basic implementation with code examples, and shows how to integrate the technique into Spring Boot applications while addressing class‑loader and dependency challenges.
This article explains the root cause of the thread‑pool plugin enhancement failure in SkyWalking—duplicate AgentClassLoader instances—detailing the investigation steps, code changes, and two practical solutions to ensure reliable instrumentation of ThreadPoolExecutor.
This article introduces Bistoury, a one‑stop Java application diagnostic solution that improves upon Arthas by adding a web UI, multi‑machine support, integrated agent‑proxy architecture, custom classloaders, online debugging, per‑thread CPU monitoring, and heap object statistics.
This article walks through a real‑world investigation of a Metaspace Out‑Of‑Memory error in a Java service, detailing how JVM monitoring tools, class‑loader behavior, and hot‑deployment agents contributed to the issue and presenting practical fixes and preventive measures.
This article explains the Java class‑loading mechanism, reviews the load‑link‑initialize process, describes the built‑in Bootstrap, Extension and Application class loaders, introduces the parent‑delegation model, shows its execution flow with code examples, and discusses how to customize or break the model.
The article explains how dynamically loaded dex files are optimized on Android 5.0 through 12—detailing AOT compilation via dex2oat, profile‑guided filters, runtime‑filter flags, class‑loader contexts, SELinux limits, and the use of PathClassLoader or the PMS performDexOptSecondary command to achieve performance comparable to installed APKs.
This article introduces the EasyMock platform, outlines its key capabilities for service mocking, explains the technical challenges it solves, and provides a detailed step‑by‑step walkthrough of the JSF Mock implementation—including jar acquisition, JVM class loading, dynamic proxy creation, interface registration, client invocation, and parameter matching/return logic—accompanied by code examples.
This article explains how Android installs APKs, introduces the concepts of plugins and pluginization, details class‑loader and resource‑injection mechanisms, describes four‑component communication strategies, compares several hooking techniques, and reviews major open‑source plugin frameworks such as Atlas, RePlugin, VirtualApp and Shadow.
This article introduces the EasyMock platform, explains its role in providing JSF and HTTP mock services for development and testing, outlines its architecture and capabilities, and details the step‑by‑step technical implementation of JSF Mock including jar downloading, JVM class loading, dynamic proxy creation, registration, client invocation, parameter matching, and response deserialization.
This article explains Java's reflection mechanism, its underlying principles involving the Class object, how to obtain Class instances, provides code examples, outlines common use cases such as dynamic loading, frameworks, and middleware, and concludes with a promotional note for an architecture learning collection.
This article explains the fundamentals of Android pluginization, covering class loading, resource handling, Dex and OAT formats, security considerations, and presents a lightweight plugin framework used by 58.com to reduce app size and enable dynamic updates.
The article explains how a Business Monitoring Platform isolates user‑defined Groovy scripts by assigning each script its own custom Java ClassLoader that loads uploaded JARs, breaking parent‑delegation, preventing class conflicts, reducing Metaspace growth, and dynamically creating Feign and Dubbo beans for safe, independent execution.
The Shadow framework, developed by Tencent, is an open‑source Android plugin solution that reuses independent app source code, employs zero‑reflection dynamic loading, minimizes host footprint, and provides detailed module architecture, component support, Flutter integration, and isolation mechanisms for stable, dynamic plugin development.
This article provides a comprehensive guide to Java's reflection mechanism, class loading process, ClassLoader usage, and dynamic proxy techniques, illustrating how to inspect class structures, create objects, access fields and methods, retrieve generic type information, and implement both static and dynamic proxies with practical code examples.
This article explains the Java parent‑delegation model, shows how to implement a custom ClassLoader for class hot‑swap and jar hot‑deployment, demonstrates Java SPI for dynamic service loading, and details building a plugin framework using Java Agent and Javassist for runtime bytecode enhancement.
This article explains Java's class loading mechanism, detailing memory structures, the roles of the bootstrap, extension, and application class loaders, the parent delegation model, custom class loaders, and related JVM phases such as loading, linking, and initialization, with code examples throughout.
The investigation revealed that repeatedly creating XStream objects generated thousands of CompositeClassLoader instances, inflating the JVM’s SystemDictionary and causing extremely long Ext Root Scanning during G1 Young GC pauses, which was resolved by caching XStream per class and reducing YGC pauses from seconds to milliseconds.
This article provides a comprehensive overview of the JVM's memory layout, class loading subsystem, classloader categories, the parent‑delegation model, and custom classloader implementation, illustrating each concept with detailed explanations and code examples for Java developers.
This article explains the Java parent‑delegation model, shows how to implement custom ClassLoaders for class hot‑swap and jar hot‑deployment, demonstrates SPI‑based class replacement, introduces Java Agent premain/agentmain mechanisms, and presents a plugin framework that combines SPI, Java Agent, and Javassist for dynamic enhancement.
This article explores Java’s ClassLoader mechanism, detailing its core API methods, hierarchical delegation model, and the nuances of class loading in Java EE environments, while providing practical code examples and troubleshooting tips for common errors such as NoClassDefFoundError, NoSuchMethodError, and ClassCastException.
This article explains why Java introduced the Context ClassLoader to bypass the parent‑delegation model, demonstrates its role in SPI mechanisms such as JDBC driver loading, compares class loader behavior in Spring Boot development versus packaged execution, and highlights common pitfalls when using custom class loaders.
This article explains how the JVM loads and links class files, describes the five runtime data areas—including the Method Area, Heap, JVM Stacks, Program Counter, and Native Method Stack—and details the class‑loader hierarchy and the parent‑delegation model used during class loading.
This article explains why Java bytecode is easy to decompile and introduces several practical techniques—including isolation, class encryption, native code conversion, and various forms of code obfuscation—to increase the difficulty of reverse‑engineering Java applications.
This article explains how Spring Boot's spring-boot-maven-plugin creates an executable JAR, describes the internal structure and Manifest, details the role of JarLauncher and the custom LaunchedURLClassLoader, and provides concrete code examples for class loading and execution.
This article explains the Java class loading lifecycle, the different built‑in and custom ClassLoaders, the parent‑delegation model, reasons for breaking it (e.g., JDBC and Tomcat), how to implement custom loaders, hot‑deployment techniques, and includes typical interview code questions.
This article explains how to correctly load resources in Java using Class and ClassLoader getResource methods, compares their behavior, demonstrates batch resource retrieval, and shows how Spring's ResourceLoader and ResourcePatternResolver simplify resource access, providing practical code examples and best‑practice guidelines.
This article explains the complete Java class loading lifecycle—including loading, verification, preparation, resolution, initialization, usage, and unloading—details the seven scenarios that trigger active loading, illustrates the parent delegation model, and provides code examples for custom and Tomcat class loaders.
The article outlines several common techniques for protecting Java programs from decompilation, including isolation, class file encryption, native code conversion, and various forms of code obfuscation such as symbol, data, control, and preventive obfuscation, and presents a case study of a protected SCJP exam application.
This article explores using Byte Buddy to build Java agents, detailing the premain method, class loading mechanisms, handling dependency conflicts with Maven shade versus custom classloaders, and implementing a Dispatcher to bridge agent and application classloaders, providing practical code snippets and diagrams for each step.
This article reviews Java’s default class loading mechanism and parent‑delegation model, explains how the model can be broken, and details Tomcat’s custom classloader architecture—including Common, Catalina, Shared, Webapp, and JSP loaders—showing why Tomcat deviates from the standard delegation hierarchy.
This article explains several techniques—including program isolation, class file encryption, native code conversion, and various obfuscation methods—to make Java applications harder to decompile and protect intellectual property.
This article explains why manual jar management can cause class loading conflicts, shows quick IDE-based steps to reorder jars for a temporary fix, and dives into JVM classloader isolation, the parent‑delegation mechanism, and Tomcat's startup loading order to help developers debug and prevent such issues.
This article explains how Spring Boot's spring-boot-maven-plugin creates an executable JAR, details the internal JAR layout, the role of the JarLauncher and custom class loader, and walks through the launch process and related source code.
This article explains the complete Java class compilation and loading lifecycle, covering lexical, syntax, and semantic analysis, annotation processing, syntax‑sugar transformation, bytecode generation, class file structure, the five loading steps, class loader types, the parent‑delegation model, and practical use cases such as dependency conflict resolution, hot‑loading, and code encryption.
This article explains how Spring Boot's spring-boot-maven-plugin creates an executable fat JAR, details its internal structure, the purpose of the JarLauncher class, and the custom class loading mechanisms used to launch the application, including code examples and manifest analysis.
This article explains how Spring Boot's spring-boot-maven-plugin creates an executable JAR, describes the internal JAR structure, the function of the JarLauncher class, and details the custom class loader mechanisms that enable Spring Boot applications to run directly with java -jar.
After upgrading an internal framework, a company’s UAT environment saw throughput drop from 53.9/s to 6.4/s due to abnormal Feign latency, prompting a deep dive with Arthas profiling, code tracing, and class‑loader analysis that uncovered costly JodaModule loading and class‑loader overhead, leading to targeted fixes that restored and even improved performance.
This article compiles essential JVM interview topics, covering ClassLoader mechanisms, Java memory layout, garbage collection concepts and algorithms, as well as practical performance tuning techniques, providing links to detailed resources and common interview questions for each area.
This article explains how the Java Virtual Machine loads .class files into memory, detailing the three-stage process of loading, linking (verification, preparation, resolution), and initialization, while also covering array loading, custom class loaders, and common pitfalls such as deprecated APIs and verification options.
This article explains Java's parent delegation class‑loading model, describes the four built‑in class loaders, details why delegation is needed, shows the loadClass implementation, and discusses how and why the mechanism can be overridden in frameworks such as JDBC, Tomcat, OSGi, and the Java 9 module system.
This article explains why jar version conflicts cause runtime errors in Java, introduces class isolation as a solution, and provides step‑by‑step implementations of custom ClassLoaders using both findClass and loadClass overrides, complete with code examples and execution results.
This article explains the Java class‑loading lifecycle—including loading, linking, and initialization—covers the parent‑delegation model, demonstrates custom class loaders, and details the bytecode steps of object instantiation, while comparing ClassLoader.loadClass with Class.forName.
The article explains how Java’s dynamic class loading, HotSwap, and multi‑ClassLoader architectures can overcome long restart times, detailing YMAP’s serverless‑style platform that uses isolated ClassLoaders, cgroup‑based multi‑tenant isolation, and rapid build‑to‑test pipelines to achieve second‑level deployments.
This article explores a Java dynamic scripting solution for platform-level systems, detailing its core implementation, handling of class name conflicts, lifecycle management, security sandboxing, thread isolation, caching strategies, and practical code examples for compilation and execution.
This article explains when and how Java classes are loaded, details the JVM's ClassLoader implementation—including the native defineClass1 method, InstanceKlass creation, SystemDictionary registration, and parallel loading locks—then demonstrates breaking the parent‑delegation model with a custom ClassLoader and discusses practical usage scenarios.
This article provides a comprehensive overview of the Java Virtual Machine (JVM) architecture, detailing its garbage collection mechanisms, class‑loader subsystem, execution engine, runtime data areas, and common GC command‑line options, offering essential knowledge for Java developers.
This article explains the difference between Java's Class.forName and ClassLoader when loading classes, shows how the initialize flag controls static initialization, provides code examples, and discusses practical scenarios such as Spring IoC and JDBC driver registration.
This article explains why Android hot‑fixes are needed, describes the structure and generation of class and dex files, compares popular hot‑fix frameworks such as Tinker and AndFix, and provides practical guidance on integrating and managing hot‑fix solutions in mobile apps.
This article explains the three phases of Java class loading—loading, linking, and initialization—detailing how the JVM handles class files, the role of different class loaders, and how to implement a custom class loader with practical code examples.
This article explains the three built‑in Java class loaders, their initialization via the Launcher, the parent‑delegation model, the role of the context class loader, how to create custom loaders, and the key changes introduced in Java 9, providing code examples and diagrams for each concept.
This article explains how to build a Java wrapper that loads and runs Groovy test scripts at runtime, covering classloader nuances, reflection-like execution, file discovery, method filtering, and provides a complete code example for a custom test framework.
This article explains the Java class‑loading workflow, the three phases of loading‑link‑initialize, the role of different ClassLoader types, and how the parent‑delegation model works—including a custom ClassLoader example and reasons for breaking the model.
This article explains why adding spring-boot-devtools can trigger a ClassCastException due to its dual classloader mechanism, demonstrates how to reproduce the issue in a Maven multi‑module project, and provides two practical solutions: customizing the RestartClassLoader or removing the devtools dependency.