mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
updated springfox templates
This commit is contained in:
parent
13ee40a4b8
commit
df771b5a4d
@ -253,7 +253,6 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
|||||||
files.add(new File(outputFilename));
|
files.add(new File(outputFilename));
|
||||||
} else {
|
} else {
|
||||||
InputStream in = this.getClass().getClassLoader().getResourceAsStream(config.templateDir() + File.separator + support.templateFile);
|
InputStream in = this.getClass().getClassLoader().getResourceAsStream(config.templateDir() + File.separator + support.templateFile);
|
||||||
//new FileInputStream(config.templateDir() + File.separator + support.templateFile);
|
|
||||||
File outputFile = new File(outputFilename);
|
File outputFile = new File(outputFilename);
|
||||||
OutputStream out = new FileOutputStream(outputFile);
|
OutputStream out = new FileOutputStream(outputFile);
|
||||||
IOUtils.copy(in,out);
|
IOUtils.copy(in,out);
|
||||||
|
@ -53,18 +53,21 @@ public class SpringfoxServerCodegen extends JavaClientCodegen implements Codegen
|
|||||||
supportingFiles.clear();
|
supportingFiles.clear();
|
||||||
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
supportingFiles.add(new SupportingFile("ApiException.mustache",
|
supportingFiles.add(new SupportingFile("apiException.mustache",
|
||||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java"));
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java"));
|
||||||
supportingFiles.add(new SupportingFile("ApiOriginFilter.mustache",
|
supportingFiles.add(new SupportingFile("apiOriginFilter.mustache",
|
||||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java"));
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java"));
|
||||||
supportingFiles.add(new SupportingFile("ApiResponseMessage.mustache",
|
supportingFiles.add(new SupportingFile("apiResponseMessage.mustache",
|
||||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java"));
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java"));
|
||||||
supportingFiles.add(new SupportingFile("NotFoundException.mustache",
|
supportingFiles.add(new SupportingFile("notFoundException.mustache",
|
||||||
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java"));
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java"));
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("swaggerConfig.mustache",
|
||||||
supportingFiles.add(new SupportingFile("SwaggerConfig.mustache",
|
|
||||||
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerConfig.java"));
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "SwaggerConfig.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("webApplication.mustache",
|
||||||
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebApplication.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("webMvcConfiguration.mustache",
|
||||||
|
(sourceFolder + File.separator + configPackage).replace(".", java.io.File.separator), "WebMvcConfiguration.java"));
|
||||||
|
|
||||||
languageSpecificPrimitives = new HashSet<String>(
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
package {{configPackage}};
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
|
||||||
|
|
||||||
|
public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?>[] getRootConfigClasses() {
|
||||||
|
return new Class[] { SwaggerConfig.class };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?>[] getServletConfigClasses() {
|
||||||
|
return new Class<?>[] { WebMvcConfiguration.class };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String[] getServletMappings() {
|
||||||
|
return new String[] { "/" };
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
package {{configPackage}};
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
|
||||||
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||||
|
|
||||||
|
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||||
|
@Override
|
||||||
|
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
|
||||||
|
configurer.enable();
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user