https://www.contentful.com is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.
This repository shows you how to use Contentful and Java Spring Boot together.
The page created contains products with a title, image, category, description, brand and tags. In Contentful, this is called a 'content type', and each content type is part of a space's 'content model' that allows you to relate resources for one project together. Read more about our content model.
We developed this example using the content model that comes pre-loaded in our "Product Catalogue" space template. Next you'll create your own space and replace the content of our example with your entries, so you can edit them and understand how Contentful works with your content.
You can deploy the app using Heroku to see how it works and experiment.
This app uses our Product Catalogue example, which you can use to power your own sites.
To run the app locally you will need the source code, which you can by cloning this repository from Heroku.
To download the source from heroku you need the heroku command line, or heroku toolbelt and use the following commands:
heroku login # login to you heroku account heroku git:clone ./ -a <contentful_app_id> # clone the app from heroku to your local filesystem
Once you have the source code, run it locally with the following command:
This will install all dependencies and run a local tomcat server on port
8080, which you can open in your browser at http://localhost:8080.
You should see an HTML page loaded with products from our example space. You can click on them to see more details.
To create a new space, follow these steps:
ACCESS_TOKENwith your new values.
./gradlew runto update the app with the newest changes.
Hit refresh in your browser and you're done! You're now running the application reading entries from your own Contentful space. In the next step we will explain how to deploy your application to Heroku and access your site from an external URL.
Now that you have verified that the webserver runs the way it should, you can update it online. To upload your app to Heroku you will need the Heroku toolbelt and run the following commands to upload to Heroku:
git add . git commit -m 'Changed credentials' git push heroku master
To see your app running your content on a remote heroku machine, do the following:
And that's it! Your own custom application is now running remotely and consuming content from Contentful. We suggest you now take a look inside the code to see how it works.