Skip to content
The API developed in Java8, SpringBoot2 for the albums-app-angular UI project
Java HTML Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Albums API

This is a SpringBoot based Restful API. It uses Spring Data JPA for persistance and Spring Security to secure the end points. It is supporting a simple Angular PWA to display albums of images and add captions to the images.

Building the project

Maven is used to build the project. Run mvn clean package to create the Spring Boot JAR in the target folder (creates caption-it-0.1.1-SNAPSHOT.jar).

If you want a Docker image, it can be built with the following command

mvn install dockerfile:build

Running the JAR

You can either use either H2 or MySQL as the database. If you are using H2 and want to start it up with some initial data, then activate the initDB profile. To enable CORS activate the CORS proflie.

You must provide the admin user credentials for the application

The following command would run the project with intial data using H2

java -jar"initDB,CORS" -DadminUser=admin -DadminPassword=admin target/caption-it-0.1.1-SNAPSHOT.jar

Once the application is up, you can access it @ http://localhost:8080/

The project also builds the documentation of the API and it can be accessed @ http://localhost:8080/docs/api-guide.html

Running the Docker image

If you are running with H2, you need to make some changes to the H2 db path. It is poiniting to the home directory ~. Use an absolute path for the db files and pass that as the -v option to Docker e.g. the db is on the directory \db then pass an argument like -v \db:\db which will map the db directory on your system to db directory on the docker instance.

If you are using MySQL, then either pass the db configuration as arguments or update the file

So this is the docker command to start the service in detached mode using the 8080 port

docker run -d -e adminUser=admin -e adminPassword=admin -e"CORS" -p 8080:8080 gsswain/caption-it

You can’t perform that action at this time.