• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aspectran / aspectran / #4738
44%

Build:
DEFAULT BRANCH: master
Ran 01 Nov 2025 10:51PM UTC
Jobs 1
Files 1018
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

01 Nov 2025 10:48PM UTC coverage: 38.181% (+0.2%) from 37.972%
#4738

push

github

topframe
Refactor: Overhaul FactoryBean and factory-method lifecycle

This commit introduces a comprehensive overhaul of the bean creation lifecycle, specifically for beans produced by a FactoryBean or a factory-method. The primary goal is to fix a critical bug where the factory instance was incorrectly injected as a dependency instead of its
product.

Key changes include:

- **Correct Dependency Injection:** The core logic in `AbstractBeanRegistry` and `AbstractBeanFactory` has been refactored to ensure that when a `FactoryBean` is requested as a dependency (e.g., in a constructor argument or autowired field), the container now correctly provides the
object created by the factory (`getObject()`) rather than the factory itself.

- **Thread-Safe Singleton Creation:** The `getScopedBean` method in `AbstractBeanRegistry` now employs a robust double-checked locking mechanism. This ensures that singleton beans, including those from factories, are instantiated in a thread-safe manner, preventing race conditions
during concurrent access.

- **Explicit BeanInstance State:** `BeanInstance` has been refactored to use static factory methods (`forProduct`, `forFactory`, `of`). This eliminates ambiguity by making the state of a bean instance (whether it holds a product, a factory, or both) explicit at the point of
creation.

- **Unified Factory Logic:** The `getFactoryProducedObject` method now centralizes the logic for obtaining a product from both `FactoryBean` instances and `factory-method` definitions. It also correctly handles the caching of singleton products.

This refactoring resolves fundamental issues in the IoC container's handling of factory-produced beans, leading to more predictable, robust, and thread-safe behavior.

48 of 107 new or added lines in 8 files covered. (44.86%)

245 existing lines in 7 files now uncovered.

15852 of 41518 relevant lines covered (38.18%)

0.38 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
23.08
23.08% core/src/main/java/com/aspectran/core/component/bean/BeanRuleException.java
1
0.0
-100.0% core/src/main/java/com/aspectran/core/component/bean/ablility/FactoryBean.java
1
0.0
0.0% core/src/main/java/com/aspectran/core/support/CurrentActivityDataFactoryBean.java
2
77.78
-22.22% core/src/main/java/com/aspectran/core/component/bean/BeanInstance.java
5
64.29
17.92% core/src/main/java/com/aspectran/core/component/bean/BeanRuleAnalyzer.java
7
65.96
4.75% core/src/main/java/com/aspectran/core/component/bean/AbstractBeanFactory.java
14
47.14
-4.52% core/src/main/java/com/aspectran/core/component/bean/scope/AbstractScope.java
28
42.68
-2.59% core/src/main/java/com/aspectran/core/component/bean/AbstractBeanRegistry.java

Uncovered Existing Lines

Lines Coverage ∆ File
1
42.68
-2.59% core/src/main/java/com/aspectran/core/component/bean/AbstractBeanRegistry.java
2
47.14
-4.52% core/src/main/java/com/aspectran/core/component/bean/scope/AbstractScope.java
11
88.7
6.08% core/src/main/java/com/aspectran/core/context/rule/BeanRule.java
21
68.9
-2.79% core/src/main/java/com/aspectran/core/component/bean/BeanRuleRegistry.java
45
65.96
4.75% core/src/main/java/com/aspectran/core/component/bean/AbstractBeanFactory.java
73
43.3
5.39% core/src/main/java/com/aspectran/core/component/bean/AnnotatedConfigParser.java
92
66.94
-0.0% core/src/main/java/com/aspectran/core/context/rule/converter/RulesToParameters.java
Jobs
ID Job ID Ran Files Coverage
1 #4738.1 01 Nov 2025 10:51PM UTC 1018
38.18
Source Files on build #4738
  • Tree
  • List 1018
  • Changed 19
  • Source Changed 17
  • Coverage Changed 15
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 0adfd192 on github
  • Prev Build on master
  • Next Build on master
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc