ich versuche api Dokumentation mit swagger2 und springfox zu implementieren. Mein Projekt ist kein Spring Boot oder Maven, es hängt von XML-Dateien ab.Prahlerei 2 Dokumentation arbeiten nicht
Ich habe die Klasse hinzugefügt:
SwaggerConfig
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@PropertySource("classpath:swagger.properties")
@ComponentScan(basePackageClasses = ProductController.class)
@Configuration
public class SwaggerConfig {
private static final String SWAGGER_API_VERSION = "1.0";
private static final String LICENSE_TEXT = "License";
private static final String title = "Products REST API";
private static final String description = "RESTful API for Products";
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title(title)
.description(description)
.license(LICENSE_TEXT)
.version(SWAGGER_API_VERSION)
.build();
}
@Bean
public Docket productsApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.pathMapping("/")
.select()
.paths(PathSelectors.regex("/*"))
.build();
}
}
so, wenn ich laufen die Tomcatbediener es normalerweise ohne Fehler ausgeführt, aber wenn ich fügen Sie den folgenden Link:
nichts passiert. Fehle ich etwas Konfiguration oder irgendeinen Vorschlag bitte?
Vielen Dank im Voraus.
haben Sie UiConfiguration Bean zu definieren versucht? –
@DmitrySenkovich Vielen Dank für Ihre Antwort, aber ich habe es geschafft, das Problem zu lösen, und ich werde die Lösung posten. – Elias