인프런 커뮤니티 질문&답변

최원호님의 프로필 이미지
최원호

작성한 질문수

[개정판 2023-11-27] Spring Boot 3.x 를 이용한 RESTful Web Services 개발

Swagger Documentation 구현 - Spring Boot 2.7 사용 ①

swagger거 실행할려고 서버실행시 문제 발생

작성

·

712

0

swaggerConfig

package com.example.restfulness.config;

import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@OpenAPIDefinition
public class SwaggerConfig {

    @Bean
    public OpenAPI api() {
        Info info=new Info().title("").version("v3").description("api");
        // Info info=new Info().title().version("v3").description("api");
        // Info info=new Info().title("").version
        return new OpenAPI().components(new Components()).info(info);
    }
}

gradle.build

plugins {
    id 'java'
    id 'org.springframework.boot' version '3.1.4'
    id 'io.spring.dependency-management' version '1.1.3'
}

group = 'com.example'
version = '0.0.1-SNAPSHOT'

java {
    sourceCompatibility = '17'
}

configurations {
    compileOnly {
       extendsFrom annotationProcessor
    }
}

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    compileOnly 'org.projectlombok:lombok'
    developmentOnly 'org.springframework.boot:spring-boot-devtools'
    runtimeOnly 'com.h2database:h2'
    annotationProcessor 'org.projectlombok:lombok'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    implementation 'org.springframework.boot:spring-boot-starter-validation'

    //@XML
    implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml'

    //@헤테오스
    implementation 'org.springframework.boot:spring-boot-starter-hateoas'
    //implementation 'org.springframework.boot:spring-boot-starter-parent'

    //@스웨거
    implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.4'
    //implementation 'org.springdoc:springdoc-openapi-ui'

}


tasks.named('test') {
    useJUnitPlatform()
}

 

그리고 서버를 재 구동했는데 다음과 같은 메세지가 나타났습니다. 어떻게 해야 할까요?

 

4:23:01 AM: Executing 'dependencies'...

> Task :dependencies

------------------------------------------------------------

Root project 'restfulness'

------------------------------------------------------------

annotationProcessor - Annotation processors and their dependencies for source set 'main'.

\--- org.projectlombok:lombok -> 1.18.30

bootArchives - Configuration for Spring Boot archive artifacts. (n)

No dependencies

compileClasspath - Compile classpath for source set 'main'.

+--- org.projectlombok:lombok -> 1.18.30

+--- org.springframework.boot:spring-boot-starter-data-jpa -> 3.1.4

| +--- org.springframework.boot:spring-boot-starter-aop:3.1.4

| | +--- org.springframework.boot:spring-boot-starter:3.1.4

| | | +--- org.springframework.boot:spring-boot:3.1.4

| | | | +--- org.springframework:spring-core:6.0.12

| | | | | \--- org.springframework:spring-jcl:6.0.12

| | | | \--- org.springframework:spring-context:6.0.12

| | | | +--- org.springframework:spring-aop:6.0.12

| | | | | +--- org.springframework:spring-beans:6.0.12

| | | | | | \--- org.springframework:spring-core:6.0.12 (*)

| | | | | \--- org.springframework:spring-core:6.0.12 (*)

| | | | +--- org.springframework:spring-beans:6.0.12 (*)

| | | | +--- org.springframework:spring-core:6.0.12 (*)

| | | | \--- org.springframework:spring-expression:6.0.12

| | | | \--- org.springframework:spring-core:6.0.12 (*)

| | | +--- org.springframework.boot:spring-boot-autoconfigure:3.1.4

| | | | \--- org.springframework.boot:spring-boot:3.1.4 (*)

| | | +--- org.springframework.boot:spring-boot-starter-logging:3.1.4

| | | | +--- ch.qos.logback:logback-classic:1.4.11

| | | | | +--- ch.qos.logback:logback-core:1.4.11

| | | | | \--- org.slf4j:slf4j-api:2.0.7 -> 2.0.9

| | | | +--- org.apache.logging.log4j:log4j-to-slf4j:2.20.0

| | | | | +--- org.apache.logging.log4j:log4j-api:2.20.0

| | | | | \--- org.slf4j:slf4j-api:1.7.36 -> 2.0.9

| | | | \--- org.slf4j:jul-to-slf4j:2.0.9

| | | | \--- org.slf4j:slf4j-api:2.0.9

| | | +--- jakarta.annotation:jakarta.annotation-api:2.1.1

| | | +--- org.springframework:spring-core:6.0.12 (*)

| | | \--- org.yaml:snakeyaml:1.33

| | +--- org.springframework:spring-aop:6.0.12 (*)

| | \--- org.aspectj:aspectjweaver:1.9.20

| +--- org.springframework.boot:spring-boot-starter-jdbc:3.1.4

| | +--- org.springframework.boot:spring-boot-starter:3.1.4 (*)

| | +--- com.zaxxer:HikariCP:5.0.1

| | | \--- org.slf4j:slf4j-api:1.7.30 -> 2.0.9

| | \--- org.springframework:spring-jdbc:6.0.12

| | +--- org.springframework:spring-beans:6.0.12 (*)

| | +--- org.springframework:spring-core:6.0.12 (*)

| | \--- org.springframework:spring-tx:6.0.12

| | +--- org.springframework:spring-beans:6.0.12 (*)

| | \--- org.springframework:spring-core:6.0.12 (*)

| +--- org.hibernate.orm:hibernate-core:6.2.9.Final

| | +--- jakarta.persistence:jakarta.persistence-api:3.1.0

| | \--- jakarta.transaction:jakarta.transaction-api:2.0.1

| +--- org.springframework.data:spring-data-jpa:3.1.4

| | +--- org.springframework.data:spring-data-commons:3.1.4

| | | +--- org.springframework:spring-core:6.0.12 (*)

| | | +--- org.springframework:spring-beans:6.0.12 (*)

| | | \--- org.slf4j:slf4j-api:2.0.2 -> 2.0.9

| | +--- org.springframework:spring-orm:6.0.12

| | | +--- org.springframework:spring-beans:6.0.12 (*)

| | | +--- org.springframework:spring-core:6.0.12 (*)

| | | +--- org.springframework:spring-jdbc:6.0.12 (*)

| | | \--- org.springframework:spring-tx:6.0.12 (*)

| | +--- org.springframework:spring-context:6.0.12 (*)

| | +--- org.springframework:spring-aop:6.0.12 (*)

| | +--- org.springframework:spring-tx:6.0.12 (*)

| | +--- org.springframework:spring-beans:6.0.12 (*)

| | +--- org.springframework:spring-core:6.0.12 (*)

| | +--- org.antlr:antlr4-runtime:4.10.1

| | +--- jakarta.annotation:jakarta.annotation-api:2.0.0 -> 2.1.1

| | \--- org.slf4j:slf4j-api:2.0.2 -> 2.0.9

| \--- org.springframework:spring-aspects:6.0.12

| \--- org.aspectj:aspectjweaver:1.9.20

+--- org.springframework.boot:spring-boot-starter-web -> 3.1.4

| +--- org.springframework.boot:spring-boot-starter:3.1.4 (*)

| +--- org.springframework.boot:spring-boot-starter-json:3.1.4

| | +--- org.springframework.boot:spring-boot-starter:3.1.4 (*)

| | +--- org.springframework:spring-web:6.0.12

| | | +--- org.springframework:spring-beans:6.0.12 (*)

| | | +--- org.springframework:spring-core:6.0.12 (*)

| | | \--- io.micrometer:micrometer-observation:1.10.11 -> 1.11.4

 

중간생략

No dependencies

(c) - A dependency constraint, not a dependency. The dependency affected by the constraint occurs elsewhere in the tree.

(*) - Indicates repeated occurrences of a transitive dependency subtree. Gradle expands transitive dependency subtrees only once per project; repeat occurrences only display the root of the subtree, followed by this annotation.

(n) - A dependency or dependency configuration that cannot be resolved.

A web-based, searchable dependency report is available by adding the --scan option.

BUILD SUCCESSFUL in 825ms

1 actionable task: 1 executed

4:23:02 AM: Execution finished 'dependencies'.

 

주소창에 localhost:8088/v2/api-docs를 입력했더니 This application has no explicit mapping for /error, so you are seeing this as a fallback.

Thu Oct 12 04:07:11 KST 2023

There was an unexpected error (type=Not Found, status=404).

No message available

가 보입니다.

 

 

답변 1

0

안녕하세요, 인프런 AI 인턴입니다.

서버 실행 시 문제가 발생하는 것 같습니다. 오류 메시지나 콘솔 출력을 제공해주시면 더 자세한 도움을 드릴 수 있을 것 같습니다. 현재로서는 주어진 코드에서는 오류를 찾을 수 없습니다.

번거로우시겠지만, 서버 실행 시 발생하는 오류 메시지와 해당 문제에 대한 추가적인 설명을 제공해주시면 좀 더 구체적인 도움을 드릴 수 있을 것 같습니다.

감사합니다.

최원호님의 프로필 이미지
최원호

작성한 질문수

질문하기