Option 1: using Atoti Server Starter (recommended)
The recommended way to configure the content service is to use the Atoti Server Starter. Once it has been added to your project, a content service will automatically be created. The content service can then be configured by setting the relevant Spring properties. First, set the content service type to use as shown below. By default, an in-memory content service is used.Hibernate content service
To use a content service backed by a database:- Make sure your database’s JDBC driver is available at runtime.
This example uses an H2 database, so the following dependency needs to be added:
- Set
atoti.server.content-service.enabled-typetohibernate. - Use a configuration such as:
url and driver properties.
Remote content service
To use a remote content service:- Set
atoti.server.content-service.enabled-typetoremote. - Use a configuration such as:
Option 2: manual bean declaration
An alternative to using the Atoti Server Starter is for your Spring configuration to define the appropriate beans.1. Create an IContentService
The first bean required is of type IContentService.
IContentService.builder() can be used to create instances of IContentService.
The following sections give examples for each content service type.
In-memory content service
Hibernate content service
databaseLocks method:
Remote content service
2. Create an IActivePivotContentService
The second bean required is of type IActivePivotContentService and wraps the first bean.
ActivePivotContentServiceBuilder can be used to create instances of IActivePivotContentService.
One way to create this bean is shown in the example below.