我试图在maven构建期间生成swagger.json文件。
这是我在pom.xml中从docs获得的插件。
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-maven-plugin</artifactId>
<version>0.2</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<apiDocsUrl>http://localhost:8080/registrationprocessor/v1/registrationstatus</apiDocsUrl>
<outputFileName>openapi.json</outputFileName>
<outputDir>${project.build.directory}</outputDir>
</configuration>
</plugin>
[INFO] --- springdoc-openapi-maven-plugin:0.2:generate (integration-test) @ registration-processor-registration-status-service ---
[ERROR] An error has occured
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect (Native Method)
at java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:399)
at java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:242)
at java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:224)
at java.net.Socket.connect (Socket.java:609)
at java.net.Socket.connect (Socket.java:558)
at sun.net.NetworkClient.doConnect (NetworkClient.java:182)
at sun.net.www.http.HttpClient.openServer (HttpClient.java:474)
at sun.net.www.http.HttpClient.openServer (HttpClient.java:569)
at sun.net.www.http.HttpClient.<init> (HttpClient.java:242)
at sun.net.www.http.HttpClient.New (HttpClient.java:341)
at sun.net.www.http.HttpClient.New (HttpClient.java:362)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient (HttpURLConnection.java:1253)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0 (HttpURLConnection.java:1187)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect (HttpURLConnection.java:1081)
at sun.net.www.protocol.http.HttpURLConnection.connect (HttpURLConnection.java:1015)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0 (HttpURLConnection.java:1592)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream (HttpURLConnection.java:1520)
at java.net.HttpURLConnection.getResponseCode (HttpURLConnection.java:527)
at org.springdoc.maven.plugin.SpringDocMojo.execute (SpringDocMojo.java:43)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
任何帮助都将不胜感激。
看起来您的应用程序没有运行在端口8080上。检查您的Spring配置,也许您设置了不同的端口?
我的目标是使用OpenAPI3.0生成Spring Boot REST客户端。 我希望首先生成API的OpenAPI规范文件(springdoc-openapi-maven-plugin),然后使用Maven从该文件(swagger-codegen-maven-plugin)生成客户机代码。 我的问题是swagger-codegen-maven-plugin在springdoc-openapi-m
我已经使用MongoDB启动了一个新的Spring Boot应用程序(2.2.1.RELEASE)。 为了创建一些API文档,我添加了springdoc API: 由于我依赖Spring来处理RESTendpoint的生成,因此我创建了以下简单的存储库: 所以我没有使用的类。 我试图添加一些ProfileRepository中方法的注释,但不会生成任何内容。 : 如何为Spring数据REST存储
问题内容: 我已经更新到了较新版本的hibernate3-maven-plugin。我在尝试使用下面提到的插件时遇到以下错误。 感谢您解决此问题的任何指示。 问题答案: 配置方式已更改为直接使用ant hibernate工具插件。因此,配置与ant插件格式完全相同,而无需额外的taskDef例如jpaconfiguration。有关更多信息,请参见hibernate ant工具参考文档:http
我有一个Spring启动应用程序,使用springdoc-openapi启用了昂首阔步的留档。由于某种原因,有一个名为/application.wadl的终结点会自动创建,而不会添加任何逻辑。有没有办法禁用wadl终结点?我没有在application.yml文件中添加特定的Wadl配置
不幸的是,SpringFox还不支持OpenAPI3,而且,当我只想将最初的yaml公开为JSON时,使用基于反射的生成器似乎毫无意义。