diff --git a/java/cqn-services/application-services.md b/java/cqn-services/application-services.md index 3d1062874..6ba19fc37 100644 --- a/java/cqn-services/application-services.md +++ b/java/cqn-services/application-services.md @@ -379,7 +379,7 @@ cds: With the annotation `@path`, you can configure the relative path of a service under which it's served by protocol adapters. The path is appended to the protocol adapter's base path. -With the annotations `@protocol` or `@protocols`, you can configure a list of protocol adapters a service should be served by. By default, a service is served by all installed protocol adapters. If you explicitly define a protocol, the service is only served by that protocol adapter. +With the annotations `@protocol` or `@protocols`, you can configure a list of protocol adapters a service should be served by. By default, a service is served by the protocols `odata-v4` and [odata-v2](../../java/migration#v2adapter). If you explicitly specify a protocol, the service is only served by that protocol adapter. In the following example, the service `CatalogService` is available on the combined paths `/odata/v4/browse` with OData V4 and `/odata/v2/browse` with OData V2: @@ -401,22 +401,33 @@ cds.application.services.CatalogService.serve: - 'odata-v2' ``` -Alternatively to the `@protocol` and `@protocols` annotation you can also use explicit protocol annotations like `@odata` (OData V4): +Alternatively to the `@protocol` and `@protocols` annotation you can also use explicit protocol annotations. For example, `@odata` (OData V4), `@odata-v4`, `@odata-v2`, and `@mcp`: ```cds -@odata service CatalogService { ... } +@odata +service CatalogService { ... } +``` + +You can also specify the path directly in the protocol annotation: + +```cds +@mcp: 'catalog' +service CatalogService { ... } ``` You can also disable serving a service if needed: ```cds -@path : 'browse' @protocol: 'none' service InternalService { ... } ``` +:::tip +Use the property cds.protocols.defaults: [] to prevent that a protocol is served accidentally. +::: + [Learn more about all `cds.application.services..serve` configuration possibilities.](../developing-applications/properties#cds-application-services--serve){.learn-more}