Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-5726

Use IoC to set a custom ClassFactory

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • Neutral
    • None
    • 5.2.3
    • core
    • None

    Description

      Before IoC was introduced in Magnolia, the way to replace the DefaultClassFactory with a custom one was by means of a Magnolia SystemProperty which info.magnolia.objectfactory.Classes would check via its getCurrentlyConfiguredClassName() method. Such property could be set by modules in the module descriptor e.g.

      <properties>
          <property>
            <name>info.magnolia.objectfactory.ClassFactory</name>      
            <value>my.module.MyClassFactory</value>
          </property>
      </properties>
      

      Now, since we have IoC support in Magnolia, this way of configuring components has become legacy (see http://wiki.magnolia-cms.com/display/DEV/Components+in+Magnolia#ComponentsinMagnolia-Legacy), yet Classes keeps on using it to instantiate the desired ClassFactory implementation. Besides that, info.magnolia.cms.core.SystemProperty has been deprecated too in the meantime.
      All the above premise to say that we should use IoC in this case too and no longer rely on properties.

      Checklists

        Acceptance criteria

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                fgrilli Federico Grilli
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:

                  Checklists

                    Task DoR