---
title: "Spring Bean Annotations in Java Classes for Workday Studio"
description: "Workday Studio wires Java classes via explicit Spring <bean> entries in assembly.xml and uses com.capeclear.assembly.annotation.@Component for the palette."
url: https://kiweely.com/guides/workday-studio-java-spring-bean-assembly
---

# 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 December 5
-   Applies to **Workday Extend**
-   7 min read
-   Published December 5
-   By Kiweely

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 |
| --- | --- | --- |
| `<bean>` XML entry | `assembly.xml` (managed on the **Beans** tab) | Instantiates the Java class at runtime and binds it to an assembly step via `ref`. |
| `@Component` (Workday) | `com.capeclear.assembly.annotation.Component` | Exposes the Java class on the Studio **Palette** with its name, tooltip, scope, and icons. |
| `@ComponentMethod` | `com.capeclear.assembly.annotation.ComponentMethod` | Marks the execution method invoked when the custom assembly element runs. |
| `@Property` | `com.capeclear.assembly.annotation.Property` | Surfaces a JavaBean getter or setter on the **Bean** tab of the element’s **Properties** view. |
| `@Component` / `@Service` (Spring) | `org.springframework.stereotype.*` | Not 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.DEFAULT` | Plain text box with no picker button. |
| `Edit.BEAN_REF` | Text box with a **Select** button to pick another Spring bean. |
| `Edit.CLASS` | Text box with a **Select** button to pick a Java class. |
| `Edit.CRON` | Text box with a dialog for building a cron expression. |
| `Edit.FILE` | Text box with a **Browse** button to select a file. |
| `Edit.FOLDER` | Text 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 |
| --- | --- |
| Input types | `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`, `javax.xml.transform.stream.StreamSource`, `javax.xml.transform.dom.DOMSource` |
| Return types | `void`, `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` |
| Output parameter types | `java.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

-   [Workday Studio: Concept: Custom Element Packaging](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-design/custom-assembly-components/qvp1513076247456.html)
-   [Workday Studio: Create Custom Java Classes and Spring Beans](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-design/custom-assembly-components/eyp1512402714879.html)
-   [Workday Studio: Concept: Custom Assembly Elements](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-design/custom-assembly-components/ono1512142683931.html)
-   [Workday Studio: Concept: Spring Bean Configuration](https://doc.workday.com/admin-guide/en-us/workday-studio/integration-design/spring-bean-configuration/lhs1513337770859.html)
-   [Workday Studio: Concept: Workday Studio (CLAR Packaging)](https://doc.workday.com/admin-guide/en-us/workday-studio/studio-fundamentals/ebp1499866049976.html)

## Related guides

[All guides](https://kiweely.com/guides)

### More guides on Integrations and APIs

[All 174 guides](https://kiweely.com/guides#integrations)

-   [Person Reference Object and Phone Numbers in Workday: SOAP, EIB, and Reporting](https://kiweely.com/guides/workday-person-reference-object-phone-number)
-   [How to Make a Workday Inbound EIB Complete With Errors for Testing](https://kiweely.com/guides/workday-eib-complete-with-error-testing)
-   [How to Sync Greenhouse and Workday Data into BigQuery for Unified HR Reporting](https://kiweely.com/guides/workday-greenhouse-bigquery-hr-reporting-sync)
-   [How to Launch Object Transporter (OX 2.0) in Workday Customer Central](https://kiweely.com/guides/workday-launch-object-transporter-customer-central)
-   [Fixing “Non-supported XPath expression with ‘@’ character” in Workday Studio XSLT 3.0](https://kiweely.com/guides/workday-studio-xslt-3-non-supported-xpath-at-character)
-   [Termination Status in Workday Core Connector: Worker (CCW) with DIS](https://kiweely.com/guides/workday-ccw-dis-termination-status-worker-changes)
-   [Workday Org Studio Error: Invalid Instance for Instance Setting](https://kiweely.com/guides/workday-org-studio-invalid-instance-for-instance-setting)
-   [Workday CCB vs Outbound EIB for Benefits Integration Files: Which Is Better?](https://kiweely.com/guides/workday-ccb-vs-eib-benefits-integration)

### From the blog on Integrations and APIs

[All posts](https://kiweely.com/blog)

-   [Migrating from SAP SuccessFactors and SAP ECC to Workday: Architecture, Conversion, and Integration Playbook](https://kiweely.com/blog/migrating-from-sap-successfactors-ecc-to-workday-playbook)
-   [Why PECI and PICOF Payroll Integrations Are the Hardest Workday Artifacts to Inherit—and How AI Untangles Them](https://kiweely.com/blog/why-peci-picof-payroll-integrations-hardest-to-inherit)
-   [Maintaining 10-Year-Old Workday XSLT Document Transformations Without a Dedicated Studio Developer](https://kiweely.com/blog/maintaining-legacy-workday-xslt-document-transformations)

## 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.

[Get in touch](https://kiweely.com/vine#partners) [See Vine at work](https://kiweely.com/vine/work)

Want it built for you? [OnoeX](https://onoex.com/?utm_source=kiweely.com&utm_medium=referral&utm_campaign=cross-site&utm_content=guide-integrations) , 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.
