MyFaces CODI
  1. MyFaces CODI
  2. EXTCDI-231

Cannot configure "ProjectStage" via properties file

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.0.2
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None

      Description

      myfaces-extcdi.properties is ignored for parameter "ProjectStage"

        Activity

        Hide
        Gerhard Petracek added a comment -

        hi brian,

        we just didn't see it (sorry) - we keep discussions on the users or dev list.

        but it doesn't change the fact that it is not intended to work for the mentioned reasons and that it's possible (but >not< suggested) to add this functionality as add-on.

        regards,
        gerhard

        Show
        Gerhard Petracek added a comment - hi brian, we just didn't see it (sorry) - we keep discussions on the users or dev list. but it doesn't change the fact that it is not intended to work for the mentioned reasons and that it's possible (but >not< suggested) to add this functionality as add-on. regards, gerhard
        Hide
        Brian Willy added a comment -

        The comment above is a valid question with no answer. Anyone have an answer?

        Show
        Brian Willy added a comment - The comment above is a valid question with no answer. Anyone have an answer?
        Hide
        Biergit added a comment -

        I really don't understand why this has to be so difficult. When you refer to the "details" of the wiki I guess you mean the vague hint that "besides the out-of-the-box project-stages it's possible to implement custom but type-safe project-stages which will be exposed by CODI."

        So what do I have to do now? Write a ConfiguredValueResolver?

        But the wiki further states: "Furthermore, there is an alternative configuration module which allows to resolve configure values from myfaces-extcdi.properties or via a custom ConfiguredValueResolver from any other configuration format/source." For me this means that it should be possible to configure my project stage in said myfaces-extcdi.properties without writing any custom code. But how do I activate the alternative configuration module? When I simply include it in my pom I get an ambiguous dependency validation exception.

        Show
        Biergit added a comment - I really don't understand why this has to be so difficult. When you refer to the "details" of the wiki I guess you mean the vague hint that "besides the out-of-the-box project-stages it's possible to implement custom but type-safe project-stages which will be exposed by CODI." So what do I have to do now? Write a ConfiguredValueResolver? But the wiki further states: "Furthermore, there is an alternative configuration module which allows to resolve configure values from myfaces-extcdi.properties or via a custom ConfiguredValueResolver from any other configuration format/source." For me this means that it should be possible to configure my project stage in said myfaces-extcdi.properties without writing any custom code. But how do I activate the alternative configuration module? When I simply include it in my pom I get an ambiguous dependency validation exception.
        Gerhard Petracek made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Won't Fix [ 2 ]
        Hide
        Gerhard Petracek added a comment -

        i added #testProjectStageSetViaPropertyFileAndCustomResolver to https://svn.apache.org/repos/asf/myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/config/ConfigTest.java which shows how to do it via a custom resolver.

        per default it isn't supported -> resolution: won't fix
        reason see:
        https://svn.apache.org/repos/asf/myfaces/extensions/cdi/trunk/core/impl/src/test/resources/META-INF/myfaces-extcdi.properties

        -> there is an explicit test that it shouldn't work >by default<.

        the wiki describes the details (see https://cwiki.apache.org/confluence/display/EXTCDI/Core+Usage#CoreUsage-ProjectStage):

        To configure a project-stage you can use the key: org.apache.myfaces.extensions.cdi.ProjectStage and configure it for your environment (see the out-of-the-box environment-config options).
        >Static< configuration files like web.xml and property files aren't supported by default because in our opinion it's a wrong and quite risky place to configure it independent of the environment - however, with a custom ConfiguredValueResolver it's possible to resolve the project-stage configuration from any kind of configuration-source.

        Show
        Gerhard Petracek added a comment - i added #testProjectStageSetViaPropertyFileAndCustomResolver to https://svn.apache.org/repos/asf/myfaces/extensions/cdi/trunk/core/impl/src/test/java/org/apache/myfaces/extensions/cdi/core/test/impl/config/ConfigTest.java which shows how to do it via a custom resolver. per default it isn't supported -> resolution: won't fix reason see: https://svn.apache.org/repos/asf/myfaces/extensions/cdi/trunk/core/impl/src/test/resources/META-INF/myfaces-extcdi.properties -> there is an explicit test that it shouldn't work >by default<. the wiki describes the details (see https://cwiki.apache.org/confluence/display/EXTCDI/Core+Usage#CoreUsage-ProjectStage): To configure a project-stage you can use the key: org.apache.myfaces.extensions.cdi.ProjectStage and configure it for your environment (see the out-of-the-box environment-config options). >Static< configuration files like web.xml and property files aren't supported by default because in our opinion it's a wrong and quite risky place to configure it independent of the environment - however, with a custom ConfiguredValueResolver it's possible to resolve the project-stage configuration from any kind of configuration-source.
        Biergit made changes -
        Field Original Value New Value
        Attachment myfaces-extcdi.properties [ 12498271 ]
        Hide
        Biergit added a comment -

        I put this in META-INF folder on the classpath of my webapp. CODI finds it on startup but the lines "if (!(String.class.isAssignableFrom(descriptor.getTargetType()) &&
        key.contains(".") && key.contains("_")))

        { return Collections.emptyList(); }

        " from PropertyFileResolver prevents loading the property values for property "ProjectStage"

        Show
        Biergit added a comment - I put this in META-INF folder on the classpath of my webapp. CODI finds it on startup but the lines "if (!(String.class.isAssignableFrom(descriptor.getTargetType()) && key.contains(".") && key.contains("_"))) { return Collections.emptyList(); } " from PropertyFileResolver prevents loading the property values for property "ProjectStage"
        Biergit created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Biergit
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development