Getting started Community Training Tutorials Documentation APIs, AI & Tools
<munit:dynamic-port propertyName="a.dynamic.port"/>
Dynamic Ports
Dynamic Ports
Anypoint Code Builder
Anypoint Studio
The MUnit Dynamic Ports element binds a free port to a property at test runtime, preventing port conflicts when running MUnit tests in parallel. You can optionally restrict the port search to a specific range using min and max values.
For example, a dynamic port would look something like this:
<munit:dynamic-port propertyName="a.dynamic.port"/>
And it can be used in the http configuration:
<http:request-config name="httpRequestConfig">
<http:request-connection host="localhost" port="${a.dynamic.port}"/>
</http:request-config>
Additionally you can set min and max values from where to get the port:
<munit:dynamic-port propertyName="a.dynamic.port" min="6000" max="7000"/>