Changes derver in OpenAPI Config to avoid CORS

This commit is contained in:
hitanshu310 2025-06-01 17:29:24 +05:30
parent 6cd3524ca0
commit ec7d3299df
2 changed files with 23 additions and 1 deletions

View File

@ -18,7 +18,7 @@ repositories {
}
dependencies {
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.8'
implementation group: 'org.springdoc', name: 'springdoc-openapi-starter-webmvc-ui', version: '2.8.5'
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

View File

@ -0,0 +1,22 @@
package com.hithomelabs.CFTunnels.Config;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
@Configuration
public class OpenApiConfig {
@Bean
public OpenAPI openAPI(){
Server httpsServer = new Server().url("https://testcf.hithomelabs.com");
OpenAPI openApi = new OpenAPI();
ArrayList<Server> servers = new ArrayList<>();
servers.add(httpsServer);
openApi.setServers(servers);
return openApi;
}
}