1

I use openjdk-17 and spring 3 (with jakarta)

I want to use io.springfox:springfox-boot-starter:3.0.0

As I understood it should work without any configurations.

build.gradle

plugins {
   id 'java'
   id 'org.springframework.boot' version '3.0.0'
   id 'io.spring.dependency-management' version '1.1.0'
   id 'org.hibernate.orm' version '6.1.5.Final'
}

group = 'com.corporation'
version = '0.0.1-SNAPSHOT'
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-security'
   implementation 'org.springframework.boot:spring-boot-starter-web'
   implementation 'org.liquibase:liquibase-core'
   implementation 'org.hibernate:hibernate-validator:8.0.0.Final'
   implementation 'org.springdoc:springdoc-openapi-ui:1.6.13'
   compileOnly 'org.projectlombok:lombok'
   developmentOnly 'org.springframework.boot:spring-boot-devtools'
   runtimeOnly 'org.postgresql:postgresql'
   annotationProcessor 'org.projectlombok:lombok'
   testImplementation 'org.springframework.boot:spring-boot-starter-test'
   //testImplementation 'org.springframework.security:spring-security-test'
   implementation 'org.mapstruct:mapstruct:1.5.3.Final'
   annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.3.Final'
   implementation "io.springfox:springfox-boot-starter:3.0.0"
}

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

hibernate {
   enhancement {
      lazyInitialization true
      dirtyTracking true
      associationManagement true
   }
}

Controller

@RequiredArgsConstructor
@RestController
@RequestMapping("/user")
@Api("asdfasdf")
public class UserController {
    private final UserService UserService;

    @GetMapping("/{id}")
    @ApiOperation("adsfa")
    public ResponseEntity<UserDto> getUserById(@PathVariable("id") int id) {
        Optional<User> optionalUser = UserService.findById(id);

        return optionalUser.map(user -> ResponseEntity.ok(UserMapper.INSTANCE.userToUserDto(user))).orElse(ResponseEntity.status(404).body(null));
    }
}

I checked urls:

  • http://localhost:8080/swagger-ui
  • http://localhost:8080/swagger-ui/
  • http://localhost:8080/swagger-ui.html
  • http://localhost:8080/swagger-ui/index.html

I got 404

I want to get swagger-ui page

bleschunov
  • 41
  • 6

0 Answers0