Skip to content

st-tu-dresden/guestbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Sample Java Web-Application

Build Status Gitpod ready-to-code

Purpose of this sample project is to make students familiar with basic technologies they’re going to use during the Software Engineering Lab at Technical University of Dresden.

Quickstart

Using GitPod

GitPod is a cloud IDE that allows you to work with a project right from your browser:

  1. Click this link to open the project in GitPod.

  2. Wait for the build to finish (see progress in the console view).

  3. Once the website opens in the embedded preview browser, the project is ready to be worked with. You might need to click on the Open in browser button besides the URL in the embededed preview browser.

Local machine

Note
Working on your local machine requires Java 21, and a recent Git (2.21 or better preferred) to be available on your machine. If you miss any of those go through the steps described in Prerequisites. Also, note that you have to run mvnw.cmd instead of ./mvnw if you run Windows by accident.
$ git clone https://github.com/st-tu-dresden/guestbook
$ cd guestbook
$ ./mvnw clean package
$ ./mvnw spring-boot:run

After that point your browser to http://localhost:8080. Note that Spring Boot creates a default user user with a random password printed to the console when the application starts, as described in the Spring Boot reference docs.

Prerequisites

Java 21

Download the binaries, install. Make sure the console shows something like this:

$ java -version
openjdk version "21.0.3" 2024-04-16 LTS
OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode, sharing)

Make sure that the wrapped Maven picks up the same JDK version and that the following command shows similar output (Windows Example):

$ .\mvnw.cmd --version
Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
Maven home: C:\Users\USER\.m2\wrapper\dists\apache-maven-3.8.6-bin\67568434\apache-maven-3.8.6
Java version: 21.0.3, vendor: Eclipse Adoptium, runtime: C:\PATH\TO\JDK\jdk-21.0.3.9-hotspot
Default locale: de_DE, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Git

Download the binaries, run the installer. Verify the command line shows something like this after install:

$ git --version
git version 2.33.0

IDE Setup

Eclipse

Grab the latest Spring Tool Suite (plain Eclipse should work as well), run installer or unzip and run it.

Select File  Import, select Maven  Existing Maven Projects, select the folder you checked the project out into and hit Finish. This will import the project into your workspace.

In the Console view you might wanna click the Open Console button and select Maven Console to see that Maven is downloading dependencies, sources and Javadocs.

IntelliJ

Grab the latest IntelliJ IDEA IDE (both Community Edition and Ultimate Edition will work), install it according to the instructions on their website and run it.

Open from local disk

From the Welcome Screen, select Open. Otherwise, if you’ve already opened another project, you’ll need to select File  Open…. Now, navigate to the folder you checked the project out into (it should contain pom.xml), select it and hit Open. When asked whether to trust and open the Maven project, proceed with Trust Project.

Open from VCS

If you want to clone the project from GitHub, you can do so directly from IntelliJ IDEA. T From the Welcome Screen, select Get from VCS. Otherwise, if you’ve already opened another project, you’ll need to select File  New​[Project from Version Control…​]. Paste the URL `https://github.com/st-tu-dresden/guestbook' into the URL field, select a directory to clone the project into and hit Clone. When asked whether to open the project, proceed with Yes.

Now you have to wait a bit while IntelliJ and Maven work on importing the project, which includes downloading all required dependencies from the internet. All IDE activities are displayed in the status bar.

Technology stack

This sample application is build on top of the following technologies:

Spring Boot

Rapid application development framework based on Spring (see below).

Spring Framework

The de-facto standard Java application framework.

Spring Data JPA

Spring module to easily build data access layers using JPA 2.2 (Jakarta Persistence API).

Thymeleaf

Library to build HTML web views using natural templating.

Semantic UI and Bootstrap

CSS frameworks to build responsive web applications.

HTMX

Library to build dynamic web applications using HTML and JavaScript (AJAX).