@Inject is hardwired for TextProvider
-------------------------------------

                 Key: WW-2810
                 URL: https://issues.apache.org/struts/browse/WW-2810
             Project: Struts 2
          Issue Type: Improvement
          Components: Core Actions
    Affects Versions: 2.1.1
            Reporter: Scott Stanlick
            Priority: Minor


After trying to inject my own TextProvider and not getting it to work, I 
started looking at source.  It appears that several aspects of this 
configuration could use some cleaning up.  First off, TextProviderFactory 
creates a TextProviderSupport in the getTextProvider() method, making it 
impossible to inject a custom implementation.  Second, the 
OgnlValueStackFactory has the following injected method:

    @Inject("system")
    public void setTextProvider(TextProvider textProvider) {
        this.textProvider = textProvider;
    }

The name "system" is coming from the struts-default.xml as follows:

 <bean type="com.opensymphony.xwork2.TextProvider" name="system" 
class="com.opensymphony.xwork2.DefaultTextProvider" />

Any attempt to override this type with the name "system" in a duplication 
violation.

It seems the right thing would be to add a struts.textProvider property and 
remove this hard coding.


BTW, what is the value in having the TextProvider instance as a composite of 
the OgnlValueStackFactory?  It appears to be hiding in the shadow of the 
TextProviderSupport.

Scott



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to