starting with OpenAPI documentation
Signed-off-by: Peter Siegmund <developer@mars3142.org>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
# Stage that builds the application, a prerequisite for the running stage
|
# Stage that builds the application, a prerequisite for the running stage
|
||||||
FROM eclipse-temurin:21-jdk-jammy AS build
|
FROM eclipse-temurin:21-jdk-noble AS build
|
||||||
|
|
||||||
ARG SERVICE_ROOT
|
ARG SERVICE_ROOT
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@ COPY --chown=app:app ${SERVICE_ROOT}/src ./src
|
|||||||
RUN ./mvnw --batch-mode clean verify -DskipTests
|
RUN ./mvnw --batch-mode clean verify -DskipTests
|
||||||
|
|
||||||
# Running stage: the part that is used for running the application
|
# Running stage: the part that is used for running the application
|
||||||
FROM eclipse-temurin:21-jre-jammy
|
FROM eclipse-temurin:21-jre-noble
|
||||||
|
|
||||||
RUN useradd -m app
|
RUN useradd -m app
|
||||||
USER app
|
USER app
|
||||||
|
5
pom.xml
5
pom.xml
@@ -83,6 +83,11 @@
|
|||||||
<artifactId>caffeine</artifactId>
|
<artifactId>caffeine</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||||
|
<version>2.6.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@@ -0,0 +1,24 @@
|
|||||||
|
package dev.mars3142.fhq.timezone_service.config;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
|
import io.swagger.v3.oas.models.info.Info;
|
||||||
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class OpenAPIConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI timeZoneOpenAPI() {
|
||||||
|
return new OpenAPI()
|
||||||
|
.info(new Info().title("TimeZone API").version("1.0"))
|
||||||
|
.servers(
|
||||||
|
List.of(
|
||||||
|
new Server().url("https://api.firmware-hq.dev/v1/timezone"),
|
||||||
|
new Server().url("http://localhost:8090")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,16 @@
|
|||||||
|
package dev.mars3142.fhq.timezone_service.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
|
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@EnableWebMvc
|
||||||
|
public class WebConfig implements WebMvcConfigurer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCorsMappings(CorsRegistry registry) {
|
||||||
|
registry.addMapping("/**");
|
||||||
|
}
|
||||||
|
}
|
@@ -1,21 +0,0 @@
|
|||||||
package dev.mars3142.fhq.timezone_service.root.web.controller;
|
|
||||||
|
|
||||||
import java.net.URI;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/")
|
|
||||||
public class RootController {
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
public ResponseEntity<Void> getRoot() {
|
|
||||||
return ResponseEntity.status(HttpStatus.SEE_OTHER)
|
|
||||||
.location(URI.create("https://firmware-hq.dev"))
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 8085
|
port: 0
|
||||||
|
|
||||||
eureka:
|
eureka:
|
||||||
client:
|
client:
|
||||||
|
@@ -24,3 +24,6 @@ eureka:
|
|||||||
defaultZone: http://eureka-service.web:8761/eureka
|
defaultZone: http://eureka-service.web:8761/eureka
|
||||||
instance:
|
instance:
|
||||||
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
|
instanceId: ${spring.application.name}:${spring.application.instance_id:${random.value}}
|
||||||
|
springdoc:
|
||||||
|
swagger-ui:
|
||||||
|
path: /swagger-ui.html
|
||||||
|
Reference in New Issue
Block a user