You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Adam Ruggles (JIRA)" <ji...@apache.org> on 2008/11/28 20:38:37 UTC

[jira] Created: (WW-2898) Object Factory not injected before buildBean call for type converters

Object Factory not injected before buildBean call for type converters
---------------------------------------------------------------------

                 Key: WW-2898
                 URL: https://issues.apache.org/struts/browse/WW-2898
             Project: Struts 2
          Issue Type: Bug
          Components: Dispatch Filter
    Affects Versions: 2.1.2
         Environment: NA
            Reporter: Adam Ruggles


This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.

When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Updated: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "Wes Wannemacher (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wes Wannemacher updated WW-2898:
--------------------------------

    Fix Version/s:     (was: 2.1.4)
                   2.1.5

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.5
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Commented: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45333#action_45333 ] 

Musachy Barroso commented on WW-2898:
-------------------------------------

On a second thought, the ObjectFactory is created during the bootstrap, when not all dependencies have been loaded. Only the bootstrapped dependencies will be injected at that time.

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.3
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Commented: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45332#action_45332 ] 

Musachy Barroso commented on WW-2898:
-------------------------------------

I don't understand this quite well. The ObjectFactory is created by the container, meaning that after it is created, the dependencies will be injected. I don't see how buildBeans can be called, skipping the injection step. Can you provide more details on when this happens?

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.3
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Commented: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "Adam Ruggles (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45342#action_45342 ] 

Adam Ruggles commented on WW-2898:
----------------------------------

I only noticed this as a problem, when using the guice plugin and adding an xwork-conversion.properties file.  Basically I'm defining a custom guice module in the struts.xml file.  Now when I add the xwork-conversion.properties the loading occurs before my guice module has been set and passed to guice to be created.  This causes my dependencies not to be injected.  I've seen this reported on the mailing list by other users but no one logged a bug on it.

My current work around is to create my own ObjectFactory and bypass the struts/xwork injection.

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.3
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Updated: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2898:
-----------------------------

    Fix Version/s: 2.1.3

Can you provide a patch with your proposed change?

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.3
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Updated: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso updated WW-2898:
--------------------------------

    Fix Version/s:     (was: 2.1.3)
                   2.1.4

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.4
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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


[jira] Resolved: (WW-2898) Object Factory not injected before buildBean call for type converters

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2898?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-2898.
---------------------------------

    Resolution: Won't Fix

I don't think this can be fixed with the current design. The only workaround I can think of, is injecting the container instance into the object factory, and then do a lazy init of the desired properties inside the object factory when its methods are called.

> Object Factory not injected before buildBean call for type converters
> ---------------------------------------------------------------------
>
>                 Key: WW-2898
>                 URL: https://issues.apache.org/struts/browse/WW-2898
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.1.2
>         Environment: NA
>            Reporter: Adam Ruggles
>             Fix For: 2.1.7
>
>
> This specifically affects the Guice Plugin, but it will affect any ObjectFactory implementation that needs to be injected from the struts properties.
> When a Object Factory is created the buildBean will be called before any of the @Injector methods for type converters (xwork-conversion.properties).  After the type converters have been built the properties are correctly injected and then the buildBeans are called on the remaining struts configuration beans.

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