Showcase of the Spring boot application displaying data from Kontent.ai.
First build the whole monorepo and then run in the root of this repository:
./gradlew :sample-app-spring-boot:bootRun
Now visit http://localhost:8080 and see a little subset of Dancing Goat!
This showcase is using model generator for generating models. The models are generated in the /src/main/java/kontent/ai/delivery/sample/dancinggoat/models - this generation is configured to be run as a gradle task called generateModels
as described in model generators README.
These models are then configured to be found in Kontent.aiConfiguration.java by using scanClasspathForMappings
method.
You could then use DeliveryClient
to get strongly typed model as showcased in i.e. AboutUs
model in AboutUsController.java
.
SDK provides automatic resolution of the linked components and inline linked items in rich text. This could be showcased on http://localhost:8080/articles/coffee-beverages-explained.
The only thing to do it to create a display template named by the codename of the content type - hosted_video.html in this case - and then just load strongly typed model in the controller (ArticleController.java
) and that's it.
If you wish to resolve the components/inline linked items in rich text.You could use registerInlineContentItemsResolver
method as showcased in KontentConfiguration.java.
You could generate your own Sample project by using Sample site configuration page using "Create a new Sample Project" button.
Then use this project in the app:
- In Kontent.ai, choose Project settings from the app menu.
- Under Development, choose API keys.
- Copy your Project ID.
- And then set the project ID to Kontent.aiConfiguration.java.
1.Then re-run the
./gradlew :sample-app-spring-boot:bootRun
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Web
The following guides illustrate how to use some features concretely: