Skip to content
KiweelyKiweelyKiweely

Spring Bean Annotations in Java Classes for Workday Studio

Workday Studio does not register custom Java classes with Spring stereotype annotations alone. Learn how @Component, @ComponentMethod, and @Property work alongside <bean> definitions in assembly.xml, supported method signatures, CLAR packaging, and common wiring errors.

  • Checked against Workday on
  • Applies to Workday Extend
  • 7 min read
  • Published
  • By Kiweely
On this page

Workday Studio registers custom Java classes through explicit Spring <bean> definitions inside assembly.xml, not through Spring’s org.springframework.stereotype.@Component or @Service classpath scanning. When you annotate a Java class in Workday Studio, you use Workday’s com.capeclear.assembly.annotation package (@Component, @ComponentMethod, and @Property) so the Assembly Editor recognizes the class as a reusable element on the Palette and exposes its properties on the Bean tab.

Spring Stereotype Annotations vs. Workday Studio Annotations

Developers coming from Spring Boot often add org.springframework.stereotype.Component or @Service to a Java class inside a Studio project and expect the assembly to discover it automatically. Workday Studio’s runtime container reads its Spring definitions from the <beans> block at the bottom of assembly.xml (or from an external XML file referenced with <import>), and it does not auto-register unreferenced stereotype classes onto the assembly canvas.

Mechanism Package or Location What Workday Studio Does With It
Mechanism<bean> XML entry Package or Locationassembly.xml (managed on the Beans tab) What Workday Studio Does With ItInstantiates the Java class at runtime and binds it to an assembly step via ref.
Mechanism@Component (Workday) Package or Locationcom.capeclear.assembly.annotation.Component What Workday Studio Does With ItExposes the Java class on the Studio Palette with its name, tooltip, scope, and icons.
Mechanism@ComponentMethod Package or Locationcom.capeclear.assembly.annotation.ComponentMethod What Workday Studio Does With ItMarks the execution method invoked when the custom assembly element runs.
Mechanism@Property Package or Locationcom.capeclear.assembly.annotation.Property What Workday Studio Does With ItSurfaces a JavaBean getter or setter on the Bean tab of the element’s Properties view.
Mechanism@Component / @Service (Spring) Package or Locationorg.springframework.stereotype.* What Workday Studio Does With ItNot scanned by default in assembly.xml and ignored by the Studio Palette loader.

Every custom assembly element in Workday Studio consists of three linked parts: the Java implementation class under src, the Spring <bean> configuration in assembly.xml, and the assembly element on the diagram that references that bean.

How to Generate the Annotated Java Class and Spring Bean in Studio

Workday Studio can scaffold both the annotated Java class and its <bean> XML entry in one pass. You can create five types of custom assembly elements: a custom-mediation component (from Components), a custom step (from Other), a custom-out transport (from Out Transports), a custom-error-handler (from Error Handlers), or a custom routing strategy (by selecting Create custom-strategy on a Route component’s context toolbar).

  1. Open your integration’s assembly.xml in the Assembly Editor and drop one of the custom elements onto the canvas.
  2. Open the element’s Properties view and click Create Spring Bean Properties and Java Class to the right of the Spring Bean field.
  3. Enter a unique Id for the Spring bean and choose Scope: select singleton to reuse the same instance across references, or prototype to create a new instance for each reference.
  4. Set Package, Name, Input Type, Output Type, and Method Name (the default method name is process).
  5. Check Annotate Java class to appear in palette and enter a Tooltip if you want Studio to write the @Component annotation into the generated class.
  6. Save the assembly. Studio creates the Java file inside your project’s src folder and appends the matching <bean> entry at the bottom of assembly.xml.

Using com.capeclear.assembly.annotation in Your Java Class

The CapeClear annotation package (com.capeclear.assembly.annotation.*) controls how Workday Studio displays your custom element in the IDE and how developers configure its bean properties. Apply @Component at the class level, @ComponentMethod on the method that processes the message, and @Property on either the getter or setter of any configurable JavaBean property (for example, getPrefix or setPrefix for a property named prefix).

java
package com.example.workday.custom;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.time.Instant;

import com.capeclear.assembly.annotation.Component;
import com.capeclear.assembly.annotation.ComponentMethod;
import com.capeclear.assembly.annotation.Property;
import com.capeclear.assembly.annotation.Property.Edit;
import static com.capeclear.assembly.annotation.Component.Type.*;

@Component(
    name = "TimestampPrefixStep",
    type = mediation,
    toolTip = "Prepends a UTC timestamp and optional label to the message payload.",
    scope = "singleton",
    smallIconPath = "icons/TimestampPrefixStep_16.png",
    largeIconPath = "icons/TimestampPrefixStep_24.png"
)
public class TimestampPrefixStep {

    private String label = "PROCESSED";

    @Property(
        name = "Prefix Label",
        toolTip = "Label written before the ISO-8601 timestamp.",
        order = 1,
        edit = Edit.DEFAULT
    )
    public void setLabel(String label) {
        this.label = label;
    }

    public String getLabel() {
        return label;
    }

    @ComponentMethod
    public void process(byte[] messageContent, OutputStream out) throws IOException {
        String header = label + " " + Instant.now().toString() + "\n";
        out.write(header.getBytes(StandardCharsets.UTF_8));
        out.write(messageContent);
    }
}

Workday Studio stores custom element icons inside the project’s src/icons folder in two sizes: 16x16 pixels (<Name>_16.png) and 24x24 pixels (<Name>_24.png). Replace those generated files to change the icon shown on the Palette and assembly canvas.

Available @Property Editor Controls

The order attribute on @Property sorts fields in the Properties view with lower integers displayed first. The edit attribute controls which picker button Studio renders next to the input box:

edit Value Studio Properties UI Control
edit ValueEdit.DEFAULT Studio Properties UI ControlPlain text box with no picker button.
edit ValueEdit.BEAN_REF Studio Properties UI ControlText box with a Select button to pick another Spring bean.
edit ValueEdit.CLASS Studio Properties UI ControlText box with a Select button to pick a Java class.
edit ValueEdit.CRON Studio Properties UI ControlText box with a dialog for building a cron expression.
edit ValueEdit.FILE Studio Properties UI ControlText box with a Browse button to select a file.
edit ValueEdit.FOLDER Studio Properties UI ControlText box with a Browse button to select a folder.

Wiring the Spring Bean in assembly.xml

Even with @Component on the Java class, the running integration resolves the instance from the <beans> block inside assembly.xml. The custom element in your mediation flow points to the bean by its id through the ref attribute:

xml
<cc:custom-mediation id="Add_Timestamp" ref="timestampPrefixBean" routes-to="Next_Step" />

<!-- At the bottom of assembly.xml -->
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
                           http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="timestampPrefixBean"
          class="com.example.workday.custom.TimestampPrefixStep"
          scope="singleton">
        <property name="label" value="BATCH_OUT" />
    </bean>
</beans>

You do not have to edit the XML by hand. Open the Beans tab in the Assembly Editor’s Properties view to see all assembly beans under the top-level beans node. Selecting the top-level beans node enables Create ‘bean’, Create ‘alias’, and Create ‘import’ (which loads bean definitions from a separate Spring XML resource file). Selecting an individual bean or property enables Create ‘property’, Create ‘constructor-arg’, Create ‘ref’, Create ‘list’, Create ‘map’, and Create ‘value’.

Supported Method Signatures and MediationContext

For a custom step, the invoked Java method must be public, non-static, and uniquely named within the class. It may throw any exception type. Workday inspects the method’s first parameter and automatically converts the incoming message part to that Java type.

Two signatures are supported for a custom step:

  1. Return-value form: public <ReturnType> method(<InputType> input) [throws Exception]
  2. Streaming output form: public void method(<InputType> input, <OutputParamType> output) [throws Exception]

If a custom step returns void (without writing to an output parameter) or returns null, Workday leaves the mediation message unchanged.

Category Supported Java Types
CategoryInput types Supported Java Typesjava.lang.String, byte[], java.io.InputStream, javax.activation.DataHandler, javax.activation.DataSource, org.w3c.dom.Element, org.w3c.dom.Document, javax.xml.transform.Source, javax.xml.transform.stream.StreamSource, javax.xml.transform.dom.DOMSource
CategoryReturn types Supported Java Typesvoid, boolean (custom step only), java.lang.String, byte[], java.io.InputStream, javax.activation.DataHandler, javax.activation.DataSource, org.w3c.dom.Element, org.w3c.dom.Document, javax.xml.transform.Source
CategoryOutput parameter types Supported Java Typesjava.io.OutputStream, javax.xml.transform.Result

When a custom-mediation component needs direct access to assembly properties, variables, or the underlying MediationMessage, import com.capeclear.mediation.MediationContext and com.capeclear.mediation.MediationMessage in your custom Java class and interact with the runtime context inside your mediation method.

Packaging Custom Beans in JARs and CLARs

When you deploy an integration from Workday Studio, Studio packages assembly.xml, XSLT stylesheets, text schemas, compiled .class bytecode, and any project JAR libraries into a binary Cloud Archive (CLAR) file. Source .java files are not included in the CLAR.

To reuse an annotated custom element across multiple Studio integration projects:

  1. Export the compiled Java package and its src/icons PNG files as a binary JAR.
  2. Add that JAR to the classpath of any target assembly project whose assembly.xml needs the custom element.
  3. Right-click the assembly diagram background in the target project and select Refresh Customizations. The Assembly Editor scans the project classpath at startup and on refresh, loading every annotated component onto the Palette.

Troubleshooting Common Spring Bean Wiring Errors

Most Studio Java bean failures trace back to one of five mismatches between the Java source, assembly.xml, and the project classpath:

  • Class never appears on the Palette: Verify the import is com.capeclear.assembly.annotation.Component rather than org.springframework.stereotype.Component. After compiling or adding a JAR to the project classpath, right-click the assembly canvas and run Refresh Customizations.
  • Bean not found at deployment or runtime: Confirm a <bean id="..." class="..."/> definition exists inside the <beans> section of assembly.xml (or in an imported XML resource) and that its id exactly matches the ref attribute on your custom-mediation or custom step.
  • Ambiguous method error during deployment: If you leave Method Name blank on a custom step, Workday looks for a single public non-getter, non-setter method matching the supported signatures. If two methods qualify, deployment fails. Set Method Name explicitly in the element’s Properties view or keep only one matching public method.
  • MediationException: Error while invoking bean or NoClassDefFoundError: A dependency class or the custom class itself is missing from the deployed CLAR. Confirm the Java class compiles without errors under src, verify all third-party JARs are on the assembly project’s build path, rebuild the CLAR, and redeploy.
  • Configured @Property missing from the Bean tab: Studio binds @Property through standard JavaBean naming. Ensure the class exposes matching public getXxx and setXxx methods for property xxx and that the annotation is placed on either the getter or the setter.

Sources checked

Build, validate, and run integrations in Workday.

Kiweely Vine builds EIBs, Studio assemblies, and connectors in your connected tenant, rehearses loads in Sandbox, and reads back every result.

Want it built for you? OnoeX , a Workday consulting firm, delivers this with Kiweely Vine.

Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.

We’ll email you once to confirm. Unsubscribe in one click from any issue.

Protected by reCAPTCHA. Google’s privacy policy and terms apply.