DU07 to be handed in before the 8th exercise

Spring.io

Spring server

Use https://start.spring.io (Spring initializer) to create a new maven web server project.

When creating, select:

  • Maven
  • verzi 3.4.4
  • Group, artifact, name, package name - zvolte nějaké smysluplné hodnoty (ne demo a example)
  • Packaging JAR
  • Java version 21
  • Values important for successful test execution
    • Group: cz.vsb.fei
    • Artifact: java2-lab08
    • Name: java2-lab08
    • Package name: cz.vsb.fei.java2.lab08 (not an underscore but a period, otherwise they won't pass the Kelvin tests)

Add to the dependencies (using the "ADD DEPENDENCIES..." button)

  • Lombok
  • Spring Web
  • Thymeleaf
  • Spring Data JPA
  • H2 Database

Generate (download) the project and add the dependencies to pom.xml:

        <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<scope>provided</scope>
<version>6.6.11.Final</version>
</dependency>

In pom.xml add into /project/build/plugins/plugin(maven-compiler-plugin)/configuration/annotationProcessorPaths/:

                        <path>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>6.6.11.Final</version>
</path>

In pom.xml add into /project/build/plugins/plugin(maven-compiler-plugin)/:

                <executions>
<execution>
<id>process</id>
<phase>generate-sources</phase>
</execution>
</executions>

In pom.xml add into /project/build/plugins/:

            <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>

Make one REST controller (class with @RestController annotation) and add one public method without parameters that returns some string (for example hello world) with @GetMapping("/") annotation

Run the project as a regular java application and test if the text you chose appears at http://localhost:8080.

Method of submission

Submit the homework solution to the Kelvin system as the "Java 2 - Homework 1 - Maven" assignment. Upload the entire contents of the src folder and the pom.xml (and run script) file to the system. Follow the attached video below.

The project will then be compiled and Unit Tests will be performed. Due to the nature of the project and the provisional testing use of the Kelvin system in the Java 2 course, do not despair in case of failure.

This is an auxiliary test, everything will still be evaluated manually. It is important to upload the files so that everything can be evaluated and analyzed for plagiarism. I believe this is a formality and all of you are creating your own code.