@@ -26,13 +26,13 @@ public class SpringBootServerCodegen extends AbstractJavaCodegen {
26
26
27
27
public SpringBootServerCodegen () {
28
28
super ();
29
- outputFolder = "generated-code/javaSpringBoot " ;
29
+ outputFolder = "generated-code/javaSpring " ;
30
30
apiTestTemplateFiles .clear (); // TODO: add test template
31
31
embeddedTemplateDir = templateDir = "JavaSpringBoot" ;
32
32
apiPackage = "io.swagger.api" ;
33
33
modelPackage = "io.swagger.model" ;
34
34
invokerPackage = "io.swagger.api" ;
35
- artifactId = "swagger-springboot -server" ;
35
+ artifactId = "swagger-spring -server" ;
36
36
37
37
additionalProperties .put ("title" , title );
38
38
additionalProperties .put (CONFIG_PACKAGE , configPackage );
@@ -45,17 +45,14 @@ public SpringBootServerCodegen() {
45
45
cliOptions .add (CliOption .newBoolean (JAVA_8 , "use java8 default interface" ));
46
46
cliOptions .add (CliOption .newBoolean (ASYNC , "use async Callable controllers" ));
47
47
48
- supportedLibraries .put (DEFAULT_LIBRARY , "Default Spring Boot server stub." );
49
- supportedLibraries .put ("j8-async" , "Use async servlet feature and Java 8's default interface. Generating interface with service " +
50
- "declaration is useful when using Maven plugin. Just provide a implementation with @Controller to instantiate service." +
51
- "(DEPRECATED: use -Djava8=true,async=true instead)" );
48
+ supportedLibraries .put (DEFAULT_LIBRARY , "Spring-boot Server application using the SpringFox integration." );
49
+ supportedLibraries .put ("spring-mvc" , "Spring-MVC Server application using the SpringFox integration." );
52
50
53
51
CliOption library = new CliOption (CodegenConstants .LIBRARY , "library template (sub-template) to use" );
54
52
library .setDefault (DEFAULT_LIBRARY );
55
53
library .setEnum (supportedLibraries );
56
54
library .setDefault (DEFAULT_LIBRARY );
57
55
cliOptions .add (library );
58
-
59
56
}
60
57
61
58
@ Override
@@ -65,7 +62,7 @@ public CodegenType getTag() {
65
62
66
63
@ Override
67
64
public String getName () {
68
- return "springboot " ;
65
+ return "spring " ;
69
66
}
70
67
71
68
@ Override
@@ -122,17 +119,24 @@ public void processOpts() {
122
119
(sourceFolder + File .separator + apiPackage ).replace ("." , java .io .File .separator ), "NotFoundException.java" ));
123
120
supportingFiles .add (new SupportingFile ("swaggerDocumentationConfig.mustache" ,
124
121
(sourceFolder + File .separator + configPackage ).replace ("." , java .io .File .separator ), "SwaggerDocumentationConfig.java" ));
125
- supportingFiles .add (new SupportingFile ("homeController.mustache" ,
126
- (sourceFolder + File .separator + configPackage ).replace ("." , java .io .File .separator ), "HomeController.java" ));
127
- supportingFiles .add (new SupportingFile ("swagger2SpringBoot.mustache" ,
128
- (sourceFolder + File .separator + basePackage ).replace ("." , java .io .File .separator ), "Swagger2SpringBoot.java" ));
129
- supportingFiles .add (new SupportingFile ("application.properties" ,
130
- ("src.main.resources" ).replace ("." , java .io .File .separator ), "application.properties" ));
131
- }
132
-
133
- if ("j8-async" .equals (getLibrary ())) {
134
- setJava8 (true );
135
- setAsync (true );
122
+ if (library .equals (DEFAULT_LIBRARY )) {
123
+ supportingFiles .add (new SupportingFile ("homeController.mustache" ,
124
+ (sourceFolder + File .separator + configPackage ).replace ("." , java .io .File .separator ), "HomeController.java" ));
125
+ supportingFiles .add (new SupportingFile ("swagger2SpringBoot.mustache" ,
126
+ (sourceFolder + File .separator + basePackage ).replace ("." , java .io .File .separator ), "Swagger2SpringBoot.java" ));
127
+ supportingFiles .add (new SupportingFile ("application.properties" ,
128
+ ("src.main.resources" ).replace ("." , java .io .File .separator ), "application.properties" ));
129
+ }
130
+ if (library .equals ("mvc" )) {
131
+ supportingFiles .add (new SupportingFile ("webApplication.mustache" ,
132
+ (sourceFolder + File .separator + configPackage ).replace ("." , java .io .File .separator ), "WebApplication.java" ));
133
+ supportingFiles .add (new SupportingFile ("webMvcConfiguration.mustache" ,
134
+ (sourceFolder + File .separator + configPackage ).replace ("." , java .io .File .separator ), "WebMvcConfiguration.java" ));
135
+ supportingFiles .add (new SupportingFile ("swaggerUiConfiguration.mustache" ,
136
+ (sourceFolder + File .separator + configPackage ).replace ("." , java .io .File .separator ), "SwaggerUiConfiguration.java" ));
137
+ supportingFiles .add (new SupportingFile ("application.properties" ,
138
+ ("src.main.resources" ).replace ("." , java .io .File .separator ), "swagger.properties" ));
139
+ }
136
140
}
137
141
138
142
if (this .java8 ) {
0 commit comments