The NucleusPublisher class publishes a Spring configuration (that is, a Spring ApplicationContext) to a Nucleus path. The NucleusPublisher appears in the specified location as a Nucleus NameContext (a Nucleus folder) containing the JavaBeans from the Spring ApplicationContext. You can view these Spring components in the Component Browser in ATG Dynamo Server Admin.

For example, you can have the NucleusPublisher publish an ApplicationContext to /atg/spring/FromSpring by including the following in the Spring configuration XML:

<bean name="/NucleusPublisher" class="atg.nucleus.spring.NucleusPublisher"
    singleton="true">
  <property name="nucleusPath">
    <value>/atg/spring/FromSpring</value>
  </property>
</bean>

This enables Nucleus components to refer to Spring components in this ApplicationContext. For example, a Spring component called SpringBean has this Nucleus address:

/atg/spring/FromSpring/SpringBean

Because the NucleusPublisher itself is a Spring component, it can be referred to within Nucleus as:

/atg/spring/FromSpring/NucleusPublisher

The NucleusPublisher class is not in the main Oracle ATG Web Commerce CLASSPATH, but is included in a separate JAR file, <ATG10dir>/DAF/spring/lib/springtonucleus.jar. NucleusPublisher requires access to the Spring classes, so the springtonucleus.jar must be added to the WEB-INF/lib directory of the web application containing the Spring configuration to be exported.

Note: The Nucleus NameContext created by the NucleusPublisher is not be available until the web application containing the Spring configuration has been started, so any Nucleus components that depend on Spring components must be started up after NucleusPublisher. Therefore, NucleusPublisher has an initialServicePaths property, which can be configured with the paths of Nucleus components to start up after NucleusPublisher has published the Spring ApplicationContext. This property must be configured through the Spring configuration XML file, not through a Nucleus .properties file.

Naming Conflicts

Spring names can contain slash (/) characters, which are not legal in Nucleus names (because they are used as path separators in Nucleus addresses). Therefore, when the NucleusPublisher publishes Spring components to Nucleus, it replaces each slash character in a component’s name with a period. For example, a Spring component named /my/spring is named .my.spring in Nucleus.

If this character substitution results in multiple components having the same Nucleus name, the names are differentiated by adding -2 to the name of the second component, -3 to the third, and so on. For example, if a Spring ApplicationContext has components named .my.spring, /my/spring, and /my.spring, their Nucleus names are .my.spring, .my.spring-2, and .my.spring-3.