[jira] Created: (WW-2765) add setting for autowire=none

View: New views
3 Messages — Rating Filter:   Alert me  

[jira] Created: (WW-2765) add setting for autowire=none

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

add setting for autowire=none
-----------------------------

                 Key: WW-2765
                 URL: https://issues.apache.org/struts/browse/WW-2765
             Project: Struts 2
          Issue Type: Improvement
          Components: Plugin - Spring
    Affects Versions: 2.0.11.2
            Reporter: Brad Cupit


struts.objectFactory.spring.autoWire can be set to
name
type
auto
constructor

but internally Spring has 5 autowire settings (in AutowireCapableBeanFactory):
AUTOWIRE_NO
AUTOWIRE_BY_NAME
AUTOWIRE_BY_TYPE
AUTOWIRE_CONSTRUCTOR
AUTOWIRE_AUTODETECT

This is a request to add support for no autowiring to the Struts 2 Spring plugin.

--- Reason for this feature request ---
The struts-spring-plugin makes it so you don't have to manually configure your actions in spring xml files, but with Spring 2.5's new annotation support and classpath scanning, you don't have to manually configure any beans in spring xml files.

With this setup, it would be nice if the struts-spring-plugin did not attempt to autowire beans itself but instead asked Spring for the bean, and if it wasn't found, no autowiring would occur.

I would suggest a new setting of
struts.objectFactory.spring.autoWire = no

Enabling this new setting would also fix bug #WW-2479

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


[jira] Updated: (WW-2765) add setting for autowire=no

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


     [ https://issues.apache.org/struts/browse/WW-2765?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brad Cupit updated WW-2765:
---------------------------

    Summary: add setting for autowire=no  (was: add setting for autowire=none)

> add setting for autowire=no
> ---------------------------
>
>                 Key: WW-2765
>                 URL: https://issues.apache.org/struts/browse/WW-2765
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Spring
>    Affects Versions: 2.0.11.2
>            Reporter: Brad Cupit
>
> struts.objectFactory.spring.autoWire can be set to
> name
> type
> auto
> constructor
> but internally Spring has 5 autowire settings (in AutowireCapableBeanFactory):
> AUTOWIRE_NO
> AUTOWIRE_BY_NAME
> AUTOWIRE_BY_TYPE
> AUTOWIRE_CONSTRUCTOR
> AUTOWIRE_AUTODETECT
> This is a request to add support for no autowiring to the Struts 2 Spring plugin.
> --- Reason for this feature request ---
> The struts-spring-plugin makes it so you don't have to manually configure your actions in spring xml files, but with Spring 2.5's new annotation support and classpath scanning, you don't have to manually configure any beans in spring xml files.
> With this setup, it would be nice if the struts-spring-plugin did not attempt to autowire beans itself but instead asked Spring for the bean, and if it wasn't found, no autowiring would occur.
> I would suggest a new setting of
> struts.objectFactory.spring.autoWire = no
> Enabling this new setting would also fix bug #WW-2479

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


[jira] Commented: (WW-2765) add setting for autowire=no

by JIRA jira@apache.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/struts/browse/WW-2765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=44947#action_44947 ]

Stephan Schroeder commented on WW-2765:
---------------------------------------

i'd like to have the possibility to set
struts.objectFactory.spring.autoWire = no
too. As do the people in these threads:
http://www.nabble.com/Any-way-to-disable-autowire-on-struts-2-actions--to19958954.html#a19958954
http://www.nabble.com/Spring-autowiring-null-values-to17315791.html#a17315791

One off the key places to change is probably the setAutowireStrategy()-method of com.opensymphony.xwork2.spring.SpringObjectFactory which by now only 4 valid values:

    public void setAutowireStrategy(int autowireStrategy) {
        switch (autowireStrategy) {
            case AutowireCapableBeanFactory.AUTOWIRE_AUTODETECT:
                log.info("Setting autowire strategy to autodetect");
                this.autowireStrategy = autowireStrategy;
                break;
            case AutowireCapableBeanFactory.AUTOWIRE_BY_NAME:
                log.info("Setting autowire strategy to name");
                this.autowireStrategy = autowireStrategy;
                break;
            case AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE:
                log.info("Setting autowire strategy to type");
                this.autowireStrategy = autowireStrategy;
                break;
            case AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR:
                log.info("Setting autowire strategy to constructor");
                this.autowireStrategy = autowireStrategy;
                break;
            default:
                throw new IllegalStateException("Invalid autowire type set");
        }
    }

i'm not sure whether adding  

            case AutowireCapableBeanFactory.AUTOWIRE_NO:
                log.info("Setting autowire strategy to none");
                this.autowireStrategy = autowireStrategy;
                break;

would suffice (and whoever calls this method after reading struts.properties, eclipse doesn't find any caller in my workspace).

> add setting for autowire=no
> ---------------------------
>
>                 Key: WW-2765
>                 URL: https://issues.apache.org/struts/browse/WW-2765
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Spring
>    Affects Versions: 2.0.11.2
>            Reporter: Brad Cupit
>
> struts.objectFactory.spring.autoWire can be set to
> name
> type
> auto
> constructor
> but internally Spring has 5 autowire settings (in AutowireCapableBeanFactory):
> AUTOWIRE_NO
> AUTOWIRE_BY_NAME
> AUTOWIRE_BY_TYPE
> AUTOWIRE_CONSTRUCTOR
> AUTOWIRE_AUTODETECT
> This is a request to add support for no autowiring to the Struts 2 Spring plugin.
> --- Reason for this feature request ---
> The struts-spring-plugin makes it so you don't have to manually configure your actions in spring xml files, but with Spring 2.5's new annotation support and classpath scanning, you don't have to manually configure any beans in spring xml files.
> With this setup, it would be nice if the struts-spring-plugin did not attempt to autowire beans itself but instead asked Spring for the bean, and if it wasn't found, no autowiring would occur.
> I would suggest a new setting of
> struts.objectFactory.spring.autoWire = no
> Enabling this new setting would also fix bug #WW-2479

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

LightInTheBox - Buy quality products at wholesale price!