Tagged articles
20 articles
Page 1 of 1
Java One
Java One
Dec 12, 2025 · Backend Development

Understanding Spring Bean Scopes: When Singleton Becomes Prototype

This article explains how Spring manages bean instances, compares singleton and prototype scopes with concrete code examples, and shows why two injected beans may be equal or different depending on the @Scope annotation applied to the component class.

Bean ScopeJavaSingleton
0 likes · 3 min read
Understanding Spring Bean Scopes: When Singleton Becomes Prototype
Cognitive Technology Team
Cognitive Technology Team
Jul 7, 2025 · Backend Development

Master Spring Bean Scopes: Choose the Right Lifecycle for High‑Performance Apps

An in‑depth guide to Spring Bean scopes explains the seven standard scopes—including Singleton, Prototype, Request, Session, Application, Global Session, and WebSocket—detailing their lifecycles, configuration methods, core principles, and best‑practice scenarios to help developers choose the optimal scope for high‑performance, reliable applications.

Backend DevelopmentBean ScopeWebSocket
0 likes · 12 min read
Master Spring Bean Scopes: Choose the Right Lifecycle for High‑Performance Apps
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
May 23, 2024 · Backend Development

Spring Prototype Bean Injection: ServiceLocator vs ObjectFactoryCreating

This article explains how to define and inject prototype-scoped beans in Spring using @Scope, ServiceLocatorFactoryBean, and ObjectFactoryCreatingFactoryBean, demonstrates configuration via annotations and XML, shows code examples, compares the two FactoryBean approaches, and includes tips for bean name mapping and custom exceptions.

Bean ScopeObjectFactoryCreatingFactoryBeanServiceLocatorFactoryBean
0 likes · 9 min read
Spring Prototype Bean Injection: ServiceLocator vs ObjectFactoryCreating
Spring Full-Stack Practical Cases
Spring Full-Stack Practical Cases
Oct 16, 2023 · Backend Development

Master Spring Bean Injection: Prototype in Singleton, Lazy, Transactions & More

This guide explains how to handle various Spring bean injection and transaction challenges, including injecting prototype beans into singletons, using @Lazy, registering abstract beans, resolving multiple bean conflicts, forcing rollback without exceptions, injecting static fields, ensuring transaction consistency, enabling non‑public transactional methods, custom component scanning, and adding interfaces via AOP.

Bean ScopeJavadependency-injection
0 likes · 12 min read
Master Spring Bean Injection: Prototype in Singleton, Lazy, Transactions & More
Code Ape Tech Column
Code Ape Tech Column
Sep 16, 2022 · Backend Development

Ensuring Thread Safety for Spring Singleton Beans: Problems and Solutions

This article explains why Spring singleton beans can be unsafe in concurrent scenarios, demonstrates the issue with a controller example, and presents multiple solutions including changing bean scope, using ThreadLocal, avoiding member variables, employing concurrent collections, and leveraging distributed caches.

BackendBean ScopeSingleton
0 likes · 8 min read
Ensuring Thread Safety for Spring Singleton Beans: Problems and Solutions
Java Architect Essentials
Java Architect Essentials
Nov 24, 2021 · Backend Development

Understanding Spring Bean Scopes: Singleton vs Prototype

This article explains the differences between Spring's singleton and prototype bean scopes, describing how singleton beans are cached and shared across requests while prototype beans are created anew each time, and discusses their performance advantages, thread‑safety drawbacks, and practical implications for developers.

BackendBean ScopeJava
0 likes · 5 min read
Understanding Spring Bean Scopes: Singleton vs Prototype
IT Xianyu
IT Xianyu
Nov 18, 2020 · Backend Development

Understanding Spring Framework: Core Concepts, Advantages, and Bean Management

This article provides a comprehensive overview of the Spring framework, explaining its IoC and AOP core, architectural layers, key advantages such as decoupling and declarative transactions, bean scopes, lifecycle settings, and practical object‑creation methods for Java backend development.

BackendBean ScopeIoC
0 likes · 7 min read
Understanding Spring Framework: Core Concepts, Advantages, and Bean Management
Java Backend Technology
Java Backend Technology
Aug 18, 2020 · Backend Development

Why Spring Controllers Are Not Thread‑Safe and How to Fix Them

Spring MVC controllers are singleton by default, which can cause thread‑unsafe behavior when using non‑static member variables; this article demonstrates the issue with example endpoints, shows how prototype scope resolves it, and outlines best practices such as avoiding stateful fields or using ThreadLocal.

Bean ScopeControllerJava
0 likes · 5 min read
Why Spring Controllers Are Not Thread‑Safe and How to Fix Them
Java Backend Technology
Java Backend Technology
Apr 23, 2020 · Backend Development

Why Spring’s Constructor Injection Fails on Circular Dependencies (and How Setters Help)

This article explains what circular dependencies are in Spring, shows three ways the framework handles them—constructor injection, singleton setter injection, and prototype setter injection—illustrates each with Java classes and XML configuration, and clarifies why only the singleton setter approach avoids runtime errors.

Bean ScopeConstructor InjectionJava
0 likes · 9 min read
Why Spring’s Constructor Injection Fails on Circular Dependencies (and How Setters Help)