Annotations
What the annotation system covers in Scipio ERP 4.0 and how it loads.
Since 3.0 (2023-02), a service could be defined with a @Service annotation
instead of a <service> element in services.xml. In 4.0 the annotation
system covers every definition kind:
- Services, entities and view entities.
- Controllers: requests, views and events.
- Widgets: screens, forms, menus and trees.
The shipped applications are migrated. Commit 4d34564a9e (“Complete
XML-to-annotation migration: delete redundant XML, fix loaders and
converters”, 2026-08-30) deleted the
XML files that annotation classes now cover, across widget forms, menus,
trees and screens, service and entity definitions, and reduced
controller.xml files to includes, handlers and events. Existing XML still
loads: an application, an addon or a hot-deploy component that keeps its
<service>, <entity> or widget XML does not need to convert it.
Where each kind lives#
| Kind | Page |
|---|---|
| Services, SECA, EECA | Service annotations |
| Entities, view entities | Entity annotations |
| Controllers: requests, views, events | Controller annotations |
| Widgets: screens, forms, menus, trees | Widget annotations |
| MCP servers and tools | MCP annotations |
How the annotations are found#
You do not declare an annotation class anywhere. Each component carries a
ComponentReflectInfo with a ReflectQuery over that component’s own
classes, and each reader asks it for the classes that carry its annotation:
getAnnotatedClasses(Entity.class) for entities, and the same for services,
SECA and EECA rules, controllers and widgets.
The readers run when the model they feed is built, not in a container of their own:
ModelReadercallsEntityAnnotationReaderandViewEntityAnnotationReaderwhile it builds the entity model.ModelServiceReaderreads@Servicewhile it builds the service model.ConfigXMLReaderreads@ControllerDefwhen a webapp’s controller is first needed.ScreenAnnotationReaderreads the widget annotations when a screen is first resolved.
So a component’s annotations are available as soon as that component’s model is read, and a delegator exists by then. Put the class anywhere in the component’s source; the package does not matter.
Convert XML to annotations#
The convertXmlToAnnotation Gradle task reads an existing XML definition
file and writes the matching Java annotation class.
./gradlew convertXmlToAnnotation -PxmlFile=applications/setup/widget/SetupForms.xml
./gradlew convertXmlToAnnotation -Pcomponent=setup
./gradlew convertXmlToAnnotation -PxmlFile=... -PoutputPackage=com.ilscipio.scipio.setup.widget
./gradlew convertXmlToAnnotation -Pcomponent=setup -PremoveXml=true| Option | Meaning |
|---|---|
-PxmlFile | Convert one XML file. |
-Pcomponent | Convert every convertible XML file of one component. |
-PoutputPackage | Java package for the generated class. Defaults to a package derived from the component and file kind. |
-PremoveXml | Delete the original XML file after a successful conversion. |
A companion task, removeMigratedXml -Pcomponent=<name>, deletes XML files
that a previous conversion already fully covers, with a -PdryRun=true
preview.
Service annotations
The @Service annotation and its companions, with a real example from the manufacturing application.
Entity annotations
The @Entity and @ViewEntity annotations and their companions, with a real example from the manufacturing …
Controller annotations
The @Controller, @Request, @View and @Event annotations, with a real example from the setup application.
Widget annotations
Overview of the screen, form, menu, tree and condition annotation packages, with a real example.
MCP annotations
The nine MCP annotations that define an agent-facing server, its topics and its tools, with real examples.