Tagged articles
3 articles
Page 1 of 1
Sanyou's Java Diary
Sanyou's Java Diary
Jan 30, 2023 · Backend Development

Mastering Spring Bean Injection: 5 Ways to Register Beans in the Container

This article comprehensively reviews the various techniques for injecting beans into the Spring container—including XML and properties configuration files, annotation-based declarations, manual BeanDefinition registration, direct singleton registration, and FactoryBean usage—providing code examples, underlying principles, and practical guidance for each method.

Bean InjectionSpring Frameworkbackend-development
0 likes · 18 min read
Mastering Spring Bean Injection: 5 Ways to Register Beans in the Container
Java Architecture Diary
Java Architecture Diary
Jun 23, 2020 · Backend Development

Fixing @RefreshScope Conflict with @ConditionalOnSingleCandidate in Spring Boot

In Spring Cloud projects, adding @RefreshScope to a custom RabbitMQ ConnectionFactory can clash with @ConditionalOnSingleCandidate, preventing RabbitTemplate from being auto‑wired; this article explains the root cause, demonstrates how to diagnose the issue, and provides a solution to avoid such bean conflicts.

@RefreshScopeBean InjectionConditionalOnSingleCandidate
0 likes · 5 min read
Fixing @RefreshScope Conflict with @ConditionalOnSingleCandidate in Spring Boot
Meituan Technology Team
Meituan Technology Team
Oct 1, 2016 · Backend Development

Debugging Spring MVC @Service Bean Injection Issues with JMap and JHat

The article explains how a Spring MVC service bean was duplicated across root and child WebApplicationContexts, causing a null‑injected instance that triggered a NullPointerException, and shows how JMap and JHat were used to locate the two beans and resolve the issue by adjusting component‑scan filters or removing the @Service annotation.

Bean InjectionSpring MVCdebugging
0 likes · 14 min read
Debugging Spring MVC @Service Bean Injection Issues with JMap and JHat