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

Update to JDK 17 and SpringBoot 3 #482

Merged
merged 8 commits into from
Apr 1, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
steps:
- uses: actions/checkout@v3
-
name: Set up JDK 11
name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'temurin'
cache: maven
-
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '11'
java-version: '17'
distribution: 'adopt'
cache: maven
- name: Build with Maven
Expand Down
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This project is a reboot of Kafdrop 2.x, dragged kicking and screaming into the

# Requirements

* Java 11 or newer
* Java 17 or newer
* Kafka (version 0.11.0 or newer) or Azure Event Hubs

Optional, additional integration:
Expand Down Expand Up @@ -180,22 +180,25 @@ Starting with version 2.0.0, Kafdrop offers a set of Kafka APIs that mirror the

* `/topic`: Returns a list of all topics.

## Swagger
To help document the Kafka APIs, Swagger has been included. The Swagger output is available by default at the following Kafdrop URL:
## OpenAPI Specification (OAS)
To help document the Kafka APIs, OpenAPI Specification (OAS) has been included. The OpenAPI Specification output is available by default at the following Kafdrop URL:
```
/v2/api-docs
/v3/api-docs
```

This can be overridden with the following configuration:
It is also possible to access the Swagger UI (the HTML views) from the following URL:
```
springfox.documentation.swagger.v2.path=/new/swagger/path
/swagger-ui.html
```

Currently only the JSON endpoints are included in the Swagger output; the HTML views and Spring Boot debug endpoints are excluded.
This can be overridden with the following configuration:
```
springdoc.api-docs.path=/new/oas/path
```

You can disable Swagger output with the following configuration:
You can disable OpenAPI Specification output with the following configuration:
```
swagger.enabled=false
springdoc.api-docs.enabled=false
```

## CORS Headers
Expand Down
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.5</version>
<version>3.0.4</version>
</parent>
<groupId>com.obsidiandynamics.kafdrop</groupId>
<artifactId>kafdrop</artifactId>
<version>3.32.0-SNAPSHOT</version>
<version>4.0.0-SNAPSHOT</version>

<description>For when you have a Kafka cluster to monitor</description>

Expand Down Expand Up @@ -176,9 +176,9 @@

<!-- Swagger API docs -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>3.0.0</version>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
davideicardi marked this conversation as resolved.
Show resolved Hide resolved
<version>2.0.4</version>
</dependency>

<!-- Spring test -->
Expand Down Expand Up @@ -211,10 +211,10 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.11.0</version>
<configuration>
<source>11</source>
<target>11</target>
<source>17</source>
<target>17</target>
<fork>true</fork>
<compilerVersion>11</compilerVersion>
<compilerVersion>17</compilerVersion>
<compilerArgs>
<arg>--add-exports=jdk.management.agent/jdk.internal.agent=ALL-UNNAMED</arg>
</compilerArgs>
Expand Down
2 changes: 1 addition & 1 deletion src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:11.0.18_10-jdk
FROM eclipse-temurin:17.0.6_10-jdk

ADD kafdrop.sh /
ADD kafdrop*tar.gz /
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/kafdrop/config/CorsConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.springframework.core.annotation.*;
import org.springframework.http.*;

import javax.servlet.*;
import javax.servlet.http.*;
import jakarta.servlet.*;
import jakarta.servlet.http.*;
import java.io.*;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kafdrop/config/InterceptorConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.springframework.web.servlet.*;
import org.springframework.web.servlet.config.annotation.*;

import javax.servlet.http.*;
import jakarta.servlet.http.*;

@Component
public class InterceptorConfiguration implements WebMvcConfigurer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.context.annotation.*;
import org.springframework.stereotype.*;

import javax.annotation.*;
import jakarta.annotation.*;


@Configuration
Expand Down
41 changes: 41 additions & 0 deletions src/main/java/kafdrop/config/OASConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2017 Kafdrop contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/

package kafdrop.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* Autoconfiguration for OpenAPI Specification (OAS).
* Can be disabled by setting {@code springdoc.api-docs.enabled=false}.
*/
@Configuration
@ConditionalOnProperty(value = "springdoc.api-docs.enabled", matchIfMissing = true)
mehdihasan marked this conversation as resolved.
Show resolved Hide resolved
public class OASConfiguration {

@Bean
public OpenAPI httpApi() {
return new OpenAPI().info(new Info()
.title("Kafdrop API")
.description("JSON APIs for Kafdrop"));
}
}
117 changes: 0 additions & 117 deletions src/main/java/kafdrop/config/SwaggerConfiguration.java

This file was deleted.

15 changes: 7 additions & 8 deletions src/main/java/kafdrop/controller/AclController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

package kafdrop.controller;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.tags.Tag;
import kafdrop.model.AclVO;
import kafdrop.service.KafkaMonitor;
import org.springframework.http.MediaType;
Expand All @@ -32,6 +33,7 @@

import java.util.List;

@Tag(name = "acl-controller", description = "ACL Controller")
@Controller
public final class AclController {
private final KafkaMonitor kafkaMonitor;
Expand All @@ -44,14 +46,11 @@ public AclController(KafkaMonitor kafkaMonitor) {
public String acls(Model model) {
final var acls = kafkaMonitor.getAcls();
model.addAttribute("acls", acls);

return "acl-overview";
}

@ApiOperation(value = "getAllAcls", notes = "Get list of all acls")
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = String.class, responseContainer = "List")
})
@Operation(summary = "getAllAcls", description = "Get list of all acls", operationId = "getAllTopicsUsingGET")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Success")})
@GetMapping(path = "/acl", produces = MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody List<AclVO> getAllTopics() {
return kafkaMonitor.getAcls();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kafdrop/controller/BasicErrorController.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.*;

import javax.servlet.http.*;
import jakarta.servlet.http.*;
import java.util.*;

@Controller
Expand Down