Skip to content

WW-3647 Change autowire alwaysRespect default to true#1571

Merged
lukaszlenart merged 1 commit intomainfrom
fix/WW-3647-spring-constructor-autowiring
Feb 9, 2026
Merged

WW-3647 Change autowire alwaysRespect default to true#1571
lukaszlenart merged 1 commit intomainfrom
fix/WW-3647-spring-constructor-autowiring

Conversation

@lukaszlenart
Copy link
Member

@lukaszlenart lukaszlenart commented Feb 7, 2026

Summary

  • Change default value of struts.objectFactory.spring.autoWire.alwaysRespect from false to true
  • Update JavaDoc in StrutsConstants.java to reflect new default and reference WW-3647
  • Update field default in SpringObjectFactory.java

Problem

When a Spring String bean exists (e.g., JNDI lookup with default-value), Spring's AUTOWIRE_CONSTRUCTOR strategy incorrectly injects that value into ALL String parameters of ServletActionRedirectResult constructors, causing malformed redirect URLs like:

http://localhost:8080/XXXX/index!XXXX.action#XXXX

Solution

Change the default to true so Spring respects the configured autowire strategy (AUTOWIRE_BY_NAME by default) instead of using the legacy mixed injection approach that always tries constructor injection first.

Migration Notes

Users who rely on the legacy constructor autowiring behavior can restore it by setting:

<constant name="struts.objectFactory.spring.autoWire.alwaysRespect" value="false" />

Test plan

  • All Spring plugin tests pass (SpringObjectFactoryTest - 11 tests)
  • Manual verification with JNDI String bean scenario

Fixes WW-3647

🤖 Generated with Claude Code

Change the default value of struts.objectFactory.spring.autoWire.alwaysRespect
from false to true to fix the Spring constructor autowiring issue.

When a Spring String bean exists (e.g., JNDI lookup with default-value),
Spring's AUTOWIRE_CONSTRUCTOR strategy incorrectly injects that value into
ALL String parameters of ServletActionRedirectResult constructors, causing
malformed redirect URLs.

Setting alwaysRespect to true by default ensures the configured autowire
strategy (AUTOWIRE_BY_NAME) is consistently used, preventing unintended
bean injection.

Users who rely on the legacy constructor autowiring behavior can restore
it by setting:
<constant name="struts.objectFactory.spring.autoWire.alwaysRespect" value="false" />

Fixes https://issues.apache.org/jira/browse/WW-3647

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 7, 2026

@lukaszlenart lukaszlenart merged commit fd87425 into main Feb 9, 2026
10 checks passed
@lukaszlenart lukaszlenart deleted the fix/WW-3647-spring-constructor-autowiring branch February 9, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants