Skip to main content

One post tagged with "beam"

View All Tags

Modular beams

· 11 min read
Dries Ryckbosch
Dries Ryckbosch
Engineer
Sven Torfs
Sven Torfs
Engineer

This blog post introduces a fresh set of beam releases. The following new releases are now available.

  • minimal-jee-beam:2.2.0
  • standard-api-beam:2.0.0
  • service-api-beam:1.3.0
  • jee-backend-beam:1.0.0 (new)
  • struts-api-beam:1.0.0 (new)
  • knockout-frontend-beam:1.0.0 (new)

These releases mark a milestone in the modularization of the JEE-stack. For the first time it is possible to offer modular beams for frontend and control layer. Hence the introduction of jee-backend-beam, struts-api-beam and knockout-frontend-beam.

When upgrading please read the changelog and migration guide for each individual beam. You can find them in their respective GitHub repositories.

caution

The new beams require expanders-maven-plugin version 2026.1.0 or higher.

Splitting beams

For a long time, our primary JEE beam, the minimal-jee-beam, was a comprehensive package that included everything from the backend logic to the Struts 2 API and Knockout.js frontend. This made it easy to get started with a full-stack application, but with the arrival of API and frontend alternatives, it often forced developers to include technologies they didn't necessarily need.

By making the beams and underlying expansion resources more modular you have the option to leave some of these legacy technologies behind. This has benefits such as having fewer vulnerabilities, smaller artifacts and cleaner models.

The purpose of expander beams has always been to provide functional units to developers. Ideally these functional units are small so that they can be more easily maintained and updated. However, as functionality keeps getting added, eventually expanders beams become large enough that they can be split into smaller functional units. On the other hand some beams have always been a bit too large, encompassing a few too many concerns, such as the minimal-jee-beam, but it was not technically possible to split them yet. In both cases, at some point large beams will inevitably be split into smaller beams. In this case the minimal-jee-beam has been split into three distinct beams:

  • jee-backend-beam: This is the core of your application: Maven skeleton, JPA data layer, EJB logic layer and JNDI proxy layer.
  • struts-api-beam: Provides a full control layer implemented in Struts2. Including actions, interceptors, and the legacy web-based API.
  • knockout-frontend-beam: Contains a full view layer implemented in Knockout.js UI.

When combined, these three beams will expand exactly the same application as the minimal-jee-beam. However it does not contain net.democritus:Expanders anymore which will have an impact if you include other expansion resources in your expansion.

Modularizing net.democritus::Expanders

Splitting the minimal-jee-beam was no trivial feat. Many expansion resources needed to be updated (and many other still need to be updated), including the infamous net.democritus:Expanders. That has historically been an expansion resource which contained many expanders spanning over various technologies and concerns. Over the past years and months large efforts have been made to modularize the net.democritus:Expanders expansion resource. Modularizing the net.democritus:Expanders means that knockout and struts related expanders are isolated and split into different modules. Also the different layers in the JEE backend are split into modules. Each module results in an expansion resource that can be used independently.

Below is a simplified overview of how net.democritus:Expanders has changed in preparation for the new beam releases.

net.democritus.Expanders:9.3.0:

net.democritus.Expanders:9.4.0:

end-of-life

The net.democritus:Expanders expansion resource will not receive new updates and will stay at 9.4.0. Expansion resources should move away from using net.democritus:Expanders and use the new modules instead.

net.democritus:Expanders::9.4.0 solely exists to make the migration away from net.democritus:Expanders easier and is intended to be used for backwards compatibility while expansion resources migrate to the submodules.

Problems with splitting beams

This section shows common issues you are likely to encounter. It will be explained why they happen and how to best fix them. Note that you should not encounter any of these issues if you stay with the minimal-jee-beam.

Duplication of expanders

When you split an expansion resource, the expanders within now exist in multiple expansion resources (in the old expansion resource, and the newly split off expansion resource). This means that if both the old expansion resource and the newly split expansion resource are present, some expanders will be duplicated. This can lead to expander features being injected twice. A similar thing happens when you rename an expansion resource. In the case of renaming an expansion resource the replace configuration can be used. The replace however is not sufficient when splitting an expansion resource. For example, the jee-proxy-logic-expanders replace the net.democritus:Expanders. This means that only the expanders from the jee-proxy-logic-expanders will be present. So expansion resources that depend on expanders from net.democritus:Expanders that are not in the jee-proxy-logic-expanders will throw an error on expansion.

To help solve the issues encountered while splitting beams and modularizing expansion resources, new guardrails were added. These new guardrails require expanders-maven-plugin:2026.1.0.

New guardrails:

  • Resource version constraints
  • Added modelVersion field to expansionSettings and expansionResource to provide better feedback when the configuration causes a mismatch.
  • Added resolution tree information to ResolveResourcesResult. Use mvn expanders:dependency-tree to view this information.

Resource version constraint on Expanders:9.4.0

When replacing the minimal-jee-beam with the new smaller beams, no beam is depending on net.democritus:Expanders anymore. This causes version conflicts when other expansion resources still require an older version of it.

[ERROR] Failed to execute goal net.democritus.maven.plugins:expanders-maven-plugin:2026.1.0:expand (default-cli) on project
project-factory: Execution default-cli of goal net.democritus.maven.plugins:expanders-maven-plugin:2026.1.0:expand failed:
ExpansionResource dependency resolution failed: 'net.democritus:jee-ear-packaging-expanders::9.5.0' requires
at least 'net.democritus:Expanders::9.4.0', but resolved version was '9.2.0'
[ERROR] Either upgrade 'net.democritus:Expanders' or remove it from the (transitive) dependencies.
[ERROR] Dependency Resolution Chains:
[ERROR] - org.normalizedsystems.beam:jee-backend-beam::1.0.0
[ERROR] '-> net.democritus:jee-ear-packaging-expanders::9.5.0
[ERROR] - org.normalizedsystems:project-factory-expanders::1.10.0
[ERROR] '-> net.democritus:Expanders::9.2.0

The easiest way, but not the preferred/recommended way to solve this issue is to add a dependency on Expanders:9.4.0. Either by updating the Expanders dependency in the project-factory-expanders or by adding Expanders:9.4.0 explicitly in the expansionSettings. Expanders:9.4.0 has been created as a backwards compatibility measure and so can be used this way. However as Expanders:9.4.0 still contains all submodules it is still monolithic preventing full modularization. So while this does solve the issue it is only a temporary solution and should ideally be avoided in favor of the better solution.

Instead of including Expanders:9.4.0 in some way, it is best to replace the dependency on Expanders completely. In the case of this example the project-factory-expanders need to remove the dependency on Expanders and replace it by one or more of the submodules (e.g. jee-proxy-logic-expanders, jee-ear-packaging-expanders, ...). Only the submodules that are actually necessary should be used.

info

The minimal-jee-beam will be discontinued once most expansion resources have removed their dependency on net.democritus.Expanders. After that only the three newly created beams (jee-backend-beam, struts-api-beam and knockout-frontend-beam) will receive updates.

Leaving out Struts or Knockout

The new beams allow developers to leave out the knockout-frontend-beam and the struts-api-beam. Doing this on an existing application is in practice quite difficult.

This is because while the beams have been updated to be modular and make use of the symbiotic dependencies. Many other expansion resources do not. They often still depend on net.democritus:Expanders or don't make it possible to leave out some knockout related expanders. This makes it impossible to fully remove the struts and knockout technologies until these expansion resources have been updated.

If you do try to leave out a technology or refactor an expansion resource you might encounter the following error.

Exception in thread "main" net.democritus.elements.ElementNotFoundException: Cannot find Expander(ListHtmlExpander::net.democritus.expander.knockout.projection)

at ExpanderFeatureTreeToComposite.fetchExpander (expander=<Expander ListHtmlExpander::net.democritus.expander.knockout.projection>)
at ExpanderFeatureTreeToComposite.mapTree (tree=<ExpanderFeature >)
at FeatureTreeToComposite.mapExpanderFeatures ()


at net.democritus.expansion.ExpanderFeatureTreeToComposite.fetchExpander(ExpanderFeatureTreeToComposite.java:168)
at net.democritus.expansion.ExpanderFeatureTreeToComposite.mapTree(ExpanderFeatureTreeToComposite.java:131)
at net.democritus.expansion.FeatureTreeToComposite.mapExpanderFeatures(FeatureTreeToComposite.java:259)
at net.democritus.expansion.FeatureTreeToComposite.mapTree(FeatureTreeToComposite.java:139)
at net.democritus.expansion.ExpansionResourceTreeToComposite.mapFeatures(ExpansionResourceTreeToComposite.java:336)
at net.democritus.expansion.ExpansionResourceTreeToComposite.mapTree(ExpansionResourceTreeToComposite.java:152)
at net.democritus.model.resources.ExtractResourcesStep.convertExpansionResources(ExtractResourcesStep.java:162)
at net.democritus.model.resources.ExtractResourcesStep.performStep(ExtractResourcesStep.java:40)
at net.democritus.model.resources.ExtractResourcesStep.performStep(ExtractResourcesStep.java:27)
at net.democritus.model.common.ModelLoader.performStep(ModelLoader.java:151)
at net.democritus.model.common.ModelLoader.loadModel(ModelLoader.java:90)
at net.democritus.model.common.ModelLoader.loadModel(ModelLoader.java:54)
at net.democritus.tasks.ExpandTask.execute(ExpandTask.java:43)
at net.democritus.runner.NsxPrimeRunner.executeLocalTask(NsxPrimeRunner.java:70)
at net.democritus.runner.NsxPrimeRunner.main(NsxPrimeRunner.java:21)

In this case the knockout-frontend-beam was omitted from the expansionSettings. This means that ListHtmlExpander is not present so the expander feature cannot be injected into it which leads to this error. To solve this, expanders and expander features that depend on knockout (web-styles) should be isolated into a separate module (expansion resource) with a dependency on web-styles. This new expansion resource should then be included as a symbiotic dependency on the expansion resource it was isolated from. This will ensure that the new expansion resource will only be included if web-styles (knockout) is present in the expansion settings.

In this example web-styles is used, but the same can happen with other technologies and expansion resources, hence why it is important to make small modular expansion resources instead of monolithic expansion resources which combine different technologies and dependencies.

How to modularize an expansion resource

Note: This modularization step is optional. It is only required for expansion resource maintainers that seek a truly modular application.

Typically, expansion resources provide an extension to the NSX JEE-stack. They contain expanders and expander features targeting various technologies that are present in the JEE-stack. In order to do this, they depend on net.democritus:Expanders, which covered most of the stack. As explained above, net.democritus:Expanders has now been modularized into distinct expansion resources that group expanders per technology.

To make use of this modularization in an application, all included expansion resources must be modularized as well. Below is a step-by-step guide on how to achieve this, based on an example scenario.

Example Scenario: CSV Expanders

Suppose you have an expansion resource adding CSV download functionality. It is called csv-expanders, and it contains an integration with the Knockout frontend, the standard-api, and the Angular frontend.

Step 1: Create modular expansion resources

The first step in creating a modular expansion resource is to create a sub-module for each technology you want to split off, and then move all relevant expanders into them.

Rename your root maven resource from csv-expanders to csv-expanders-project and create a submodule csv-expanders. This module will act as the entry point for your users (as it did before because we kept the name). Next, create a submodule for your core expanders and one for each technology you want to split off. Finally, move all the expanders, features and data resources to the correct module.

You might need to add a dependency from technology specific modules to the core module to inject features or use shared data resources.

After this step, your bundle module should not contains anything more then a pom.xml.

Step 2: Add symbiotic dependencies

In this step, we will add the dynamic behavior. We only want to include technology-specific resources if the underlying technology is actually included in the application. This can be done using symbiotic dependencies.

Configure a symbiotic dependency in the bundle module (csv-expanders) for each of the modularized sub-modules. Base modules, such as csv-core-expanders, should always be present; therefore, their dependencies should not be symbiotic.

With this second step, we have now created an expansion resource that provides a feature with a set of core expanders that will always be present and optional support for a set of technologies. Using this architecture, expander maintainers can easily add support for more technologies while giving application builders the choice of what to include in their application.