Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vorbereitung zur Demo 20.11.2024 #165

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Die Frontends sind jeweils Vue Single Page Applications, die über ein Service G


## Built with
Java 11, Spring Boot 2.7, ElasticSearch 7.17
Java 21, Spring Boot 3.3, ElasticSearch 8.15

## Contributing

Expand All @@ -46,8 +46,8 @@ To add those conventions to your favorite IDE, please have a look at the [README

### BuildAndRun
Local requirements:
- Java: min Java 11
- ElasticSearch: v7.17
- Java: min Java 21
- ElasticSearch: v8.15
- Maven 3.9.7

1. Clone the Project from GitHub
Expand Down
60 changes: 44 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,36 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.release>${java.version}</maven.compiler.release>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.boot.version>3.3.3</spring.boot.version>
<spring.boot.version>3.3.5</spring.boot.version>
<spring.cloud.version>2023.0.3</spring.cloud.version>
<logstash.encoder>7.4</logstash.encoder>
<ojdbc8.version>19.9.0.0</ojdbc8.version>
<apache.commons.collections4>4.4</apache.commons.collections4>
<apache.commons.csv>1.11.0</apache.commons.csv>
<apache.commons.io>2.16.1</apache.commons.io>
<apache.commons.lang3>3.14.0</apache.commons.lang3>
<apache.commons.csv>1.12.0</apache.commons.csv>
<apache.commons.io>2.17.0</apache.commons.io>
<apache.commons.lang3>3.17.0</apache.commons.lang3>
<apache.commons.email>1.6.0</apache.commons.email>
<apache.commons.exec>1.4.0</apache.commons.exec>
<guava>33.2.1-jre</guava>
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
<apache.poi>5.3.0</apache.poi>
<guava>33.3.1-jre</guava>
<org.mapstruct.version>1.6.2</org.mapstruct.version>
<openhtmltopdf.version>1.0.10</openhtmltopdf.version>
<spullara.mustache.java.version>0.9.14</spullara.mustache.java.version>
<apache.sis.version>1.4</apache.sis.version>
<org.jsoup.version>1.17.2</org.jsoup.version>
<!-- Plugins -->
<maven-scm-plugin.version>1.10.0</maven-scm-plugin.version>
<maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
<maven-scm-plugin.version>2.1.0</maven-scm-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version>
<maven.compiler.plugin.version>3.11.0</maven.compiler.plugin.version>
<maven.compiler.plugin.version>3.13.0</maven.compiler.plugin.version>
<!-- Version muss mit der in den spring-boot-dependencies bereitgestellten Lombok-Version übereinstimmen -->
<org.projectlombok.lombok.version>1.18.34</org.projectlombok.lombok.version>
<org.projectlombok.mapstructbinding.version>0.2.0</org.projectlombok.mapstructbinding.version>
<shedlock.version>5.13.0</shedlock.version>
<openapi-generator-version>7.7.0</openapi-generator-version>
<openapi.jackson-databind-nullable>0.2.6</openapi.jackson-databind-nullable>
<ai.onnxruntime>1.18.0</ai.onnxruntime>
<!-- Bei der nächsten Spring Boot Version überprüfen, ob flyway-version wieder entfernt werden kann -->
<flyway.version>10.19.0</flyway.version>
</properties>

<scm>
Expand Down Expand Up @@ -169,6 +171,10 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>


<!-- Caching -->
Expand Down Expand Up @@ -232,17 +238,29 @@
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>


<!-- Hibernate Model Gen for type safe criterias -->
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>${ojdbc8.version}</version>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>${flyway.version}</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-database-postgresql</artifactId>
<version>${flyway.version}</version>
</dependency>

<!-- Other -->
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
Expand Down Expand Up @@ -273,7 +291,7 @@
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<version>3.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -291,7 +309,7 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.11.0</version>
<version>2.10.1</version>
<scope>test</scope>
</dependency>

Expand Down Expand Up @@ -356,6 +374,16 @@
<artifactId>guava</artifactId>
<version>${guava}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${apache.poi}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${apache.poi}</version>
</dependency>

<!-- PDF -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c): it@M - Dienstleister für Informations- und Telekommunikationstechnik
* der Landeshauptstadt München, 2023
*/
package de.muenchen.dave.configuration;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class AspectConfiguration {

@Around("@annotation(de.muenchen.dave.configuration.LogExecutionTime)")
public Object logExecutionTime(final ProceedingJoinPoint joinPoint) throws Throwable {
final long start = System.currentTimeMillis();
final Object proceed = joinPoint.proceed();
final long executionTime = System.currentTimeMillis() - start;
log.debug(">> {} executed in {} seconds", joinPoint.getSignature(), executionTime / 1000.0);
return proceed;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
Expand All @@ -17,8 +19,8 @@
import org.springframework.web.filter.OncePerRequestFilter;

/**
* The class adds a {@link HttpHeaders#CACHE_CONTROL} header to each http response, if
* the header is not already set.
* The class adds a {@link HttpHeaders#CACHE_CONTROL} header to each http response, if the header is
* not already set.
*/
@Configuration
public class CacheControlConfiguration {
Expand All @@ -34,22 +36,21 @@ public FilterRegistrationBean<CacheControlFilter> cacheControlFilter() {
}

/**
* The concrete implementation of the cache control filter
* which adds a {@link HttpHeaders#CACHE_CONTROL} to a http response,
* if the header is not already set.
* The concrete implementation of the cache control filter which adds a
* {@link HttpHeaders#CACHE_CONTROL} to a http response, if the header is not already
* set.
*/
public static class CacheControlFilter extends OncePerRequestFilter {

/**
* The method which adds the {@link HttpHeaders#CACHE_CONTROL} header
* to the {@link HttpServletResponse} given in the parameter,
* if the header is not already set.
* Same contract as for {@code super.doFilter}, but guaranteed to be
* just invoked once per request within a single request thread.
* See {@link OncePerRequestFilter#shouldNotFilterAsyncDispatch()} for details.
* The method which adds the {@link HttpHeaders#CACHE_CONTROL} header to the
* {@link HttpServletResponse} given in the parameter, if the header is not
* already set. Same contract as for {@code super.doFilter}, but guaranteed to be just invoked once
* per request within a single request thread. See
* {@link OncePerRequestFilter#shouldNotFilterAsyncDispatch()} for details.
* <p>
* Provides HttpServletRequest and HttpServletResponse arguments instead of the
* default ServletRequest and ServletResponse ones.
* Provides HttpServletRequest and HttpServletResponse arguments instead of the default
* ServletRequest and ServletResponse ones.
*/
@Override
protected void doFilterInternal(final HttpServletRequest request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
import org.springframework.context.annotation.Profile;

/**
* This class provides the caches.
* To disable the caching functionality delete this class, remove the corresponding bean creation
* methods
* or remove the annotation {@link EnableCaching} above the class definition.
* This class provides the caches. To disable the caching functionality delete this class, remove
* the corresponding bean creation methods or remove the
* annotation {@link EnableCaching} above the class definition.
*/
@Configuration
@EnableCaching
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.muenchen.dave.configuration;

import java.time.Duration;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
public class EtagConfiguration {

/**
* Bean zur Aktivierung der Versionskontrolle
* bei Entitäten für die relationale Datenbank.
* Bean zur Aktivierung der Versionskontrolle bei Entitäten für die relationale Datenbank.
* <p>
* Das relevante Attribut ist {@link BaseEntity#getEntityVersion()}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import org.springframework.web.filter.ForwardedHeaderFilter;

/**
* This class provides the {@link ForwardedHeaderFilter} to handle
* the headers of type "Forwarded" and "X-Forwarded-*".
* This class provides the {@link ForwardedHeaderFilter} to handle the headers of type "Forwarded"
* and "X-Forwarded-*".
*/
@Configuration
public class ForwardedHeaderConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;

/**
* Die Annotation {@link EnableJpaAuditing} ist erforderlich um z.B.
* die Annotation {@link CreatedDate} in Klasse {@link BaseEntity}
* funktionsfähig zu machen.
* Die Annotation {@link EnableJpaAuditing} ist erforderlich um z.B. die Annotation
* {@link CreatedDate} in Klasse {@link BaseEntity} funktionsfähig zu machen.
*/
@Configuration
@EnableJpaAuditing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package de.muenchen.dave.configuration;

import java.util.Locale;

import org.apache.commons.codec.CharEncoding;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/de/muenchen/dave/configuration/LogExecutionTime.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package de.muenchen.dave.configuration;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LogExecutionTime {
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package de.muenchen.dave.configuration;

import javax.sql.DataSource;

import net.javacrumbs.shedlock.core.LockProvider;
import net.javacrumbs.shedlock.provider.jdbctemplate.JdbcTemplateLockProvider;
import org.springframework.context.annotation.Bean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

import jakarta.servlet.http.Cookie;
import jakarta.servlet.http.HttpServletRequest;

import java.text.Normalizer;
import java.util.*;
import java.util.stream.Collectors;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.io.CharArrayReader;
import java.io.IOException;
import java.io.Reader;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletRequestWrapper;
import jakarta.servlet.http.Part;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.IteratorUtils;
import org.apache.commons.io.IOUtils;
Expand All @@ -27,15 +29,12 @@
@Slf4j
public class NfcRequest extends HttpServletRequestWrapper implements HttpServletRequest {

@SuppressWarnings("unused")
private final Set<String> contentTypes;
private Map<String, String[]> params;

private Cookie[] cookies;

private Map<String, List<String>> headers;

@SuppressWarnings("unused")
private final Set<String> contentTypes;

public NfcRequest(final HttpServletRequest request, final Set<String> contentTypes) {
super(request);
this.params = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

import jakarta.servlet.ReadListener;
import jakarta.servlet.ServletInputStream;

import java.io.ByteArrayInputStream;
import java.io.IOException;

import org.apache.commons.lang3.NotImplementedException;

/**
Expand Down
Loading
Loading