From XML to annotations: converting a Scipio ERP component
One real service definition from the manufacturing application, before and after the conversion, line by line, and the four steps to convert your own component with convertXmlToAnnotation and removeMigratedXml.

In Scipio ERP 4.0 a service, an entity, a controller and a screen can be a Java annotation instead of an XML file, and every application we ship was converted that way. Your own XML keeps loading, so there is no deadline. This post shows what the conversion does to one real definition, and how to run it on a component of your own.
One service, before and after#
The example is createBOMAssoc from the manufacturing application, the
service that adds a component to a bill of materials. In 3.x it was defined
in servicedef/services_bom.xml:
<service name="createBOMAssoc" default-entity-name="ProductAssoc" engine="simple"
location="component://manufacturing/script/org/ofbiz/manufacturing/bom/BomSimpleMethods.xml" invoke="createBOMAssoc" auth="true">
<description>Add Product to Product Association</description>
<auto-attributes include="pk" mode="IN" optional="false"/>
<auto-attributes include="nonpk" mode="IN" optional="true"/>
<attribute name="errorMessage" type="String" optional="true" mode="OUT"/>
<override name="fromDate" optional="true"/>
</service>In 4.0 the same definition is an annotation in
BomServices.java:
public class BomServices {
@Service(
name = "createBOMAssoc",
engine = "java",
location = "com.ilscipio.scipio.manufacturing.event.BomSimpleMethods",
invoke = "createBOMAssoc",
description = "Add Product to Product Association",
defaultEntityName = "ProductAssoc",
auth = "true",
entityAttributes = {
@EntityAttributes(mode = "IN", include = "pk"),
@EntityAttributes(mode = "IN", include = "nonpk", optional = "true")
},
attributes = {
@Attribute(name = "errorMessage", type = "String", mode = "OUT", optional = "true")
},
overrideAttributes = {
@OverrideAttribute(name = "fromDate", optional = "true")
}
)
public interface CreateBOMAssoc {}
}What maps to what#
- The attributes of
<service>become the attributes of@Service:default-entity-nameisdefaultEntityName, and so on. <description>becomesdescription.- Each
<auto-attributes>becomes an@EntityAttributes, each<attribute>an@Attribute, each<override>an@OverrideAttribute. - The annotation sits on an empty nested interface,
CreateBOMAssoc, inside a holder class,BomServices. The interface has no members. It only carries the definition, and one holder class keeps the services of one area together, as one XML file did.
One line changed for another reason. In 3.x the service ran a Minilang
simple method (engine="simple"). In 4.0 that logic is a Java class
(engine="java"). That was a port of the implementation, done in the same
release. The converter moves definitions, and it leaves your
implementation where it is.
What you gain#
- The attribute names are checked by the compiler. A misspelt
defaultEntityNmaedoes not build, where a misspelt XML attribute only showed up at runtime, if at all. - Your IDE completes the attribute names and shows their documentation.
- The definition lives in Java next to the code, in one language, and your refactoring tools and code search see it.
The values are still strings: a wrong entity name in defaultEntityName
is still found at runtime, as before.
Convert your own component#
Commit first. The conversion writes new Java files and, if you ask it to, deletes XML. A clean working tree gives you a diff you can review.
Convert.
./gradlew convertXmlToAnnotation -Pcomponent=mycomponentTo convert one file, pass
-PxmlFile=path/to/file.xmlinstead. Add-PoutputPackage=com.example.mycomponent.serviceto choose the Java package of the new classes.Build, start and test. The XML is still there at this point, so you can compare.
Remove the XML that was converted. See the list first:
./gradlew removeMigratedXml -Pcomponent=mycomponent -PdryRun=true ./gradlew removeMigratedXml -Pcomponent=mycomponentOr do steps 2 and 4 in one go with
convertXmlToAnnotation -Pcomponent=mycomponent -PremoveXml=true.
Every annotation, with every attribute, is in the reference: Services , Entities , Controllers and Widgets .
More news
- Functions & Services
DATEV export in Scipio ERP: one ZIP for your tax advisor
Scipio ERP now exports the posted ledger in the DATEV format: Buchungsstapel, Debitoren/Kreditoren and Kontenbeschriftungen in one ZIP, for SKR03, SKR04, SKR07 or your own chart. How it …
- Developer
ACP, UCP, AP2: three agentic commerce protocols and what a shop needs
The Agentic Commerce Protocol, Google's Universal Commerce Protocol and the Agent Payments Protocol all promise that an AI agent can buy for a person. Who is behind each one, what each …
- Functions & Services
E-invoicing in Germany: what changes on 1 January 2027
From 2027 a German business with more than EUR 800,000 turnover must issue e-invoices to other businesses, and from 2028 every business must. The dates, the exceptions, the formats that …