Getting started using the prismic.io Java starter kit
prismic.io makes it easy to get started on a new Java project by providing a specific Java starter project kit. To get started you need to define, edit, and publish your content in a prismic.io content repository. Next you can use the starter kit to query and fetch content from your API, and integrate it into your website templates.
Create a content repository
A content repository is where you define, edit and publish content.
Download the development kit
The SDK allows you to query and fetch content from your content repository and integrate it into your template. It's the easiest way to get started with a new project. Integration with an existing project or a different framework than the one used in the SDK is detailed at the bottom of this page.
Configure and run your project
Unzip the downloaded file in a new location for your project.
Replace "lesbonneschoses" in the repository url in your src/main/webapp/WEB-INF/web.xml file with your repository name.
<!-- in the filter definition, in web.xml --> <init-param> <param-name>endpoint</param-name> <param-value>https://your-repo-name.prismic.io/api</param-value> <!-- param-name>accessToken</param-name> <param-value>xxxx</param-value --> </init-param>
Fire up a terminal (command prompt or similar on Windows), point it to your project location and run the following command. Note that you will need to have Maven installed on your machine.
You can now open your browser to http://localhost:8080/ and see the project running. It will list your documents which you can click on to get a simple preview of the content.
And your prismic.io journey begins!
Now you're all set to start building your website with prismic.io content management. Here are the next steps you need to take.
Define your Custom Types
First you’ll need to model your pages, posts, events, etc. into your Custom Types. Refer to our user-guides to learn more about constructing your Custom Types using our easy drag-n-drop builder.
Query your documents
After you’ve created and published some documents in your repository, you’ll be able to query the API to retrieve your content. We provide explanations and plenty of examples of queries in the documentation. Start by learning more on the How to Query the API page.
Integrate content into your templates
The last step is to integrate the content into your templates. Helper functions are provided for each content field type to make integration as easy as possible. Check out our Templating documentation to learn more.
Working with existing projects
If you already have a website you want to integrate prismic.io to, want to use a different framework than proposed in the SDK or simply prefer to use your own tools to bootstrap the project, you can simply add the library as a dependency.
<!-- Check Maven Central to make sure you're using the latest version --> <dependency> <groupId>io.prismic</groupId> <artifactId>java-kit</artifactId> <version>1.5.0</version> </dependency>