@@ -43,6 +43,7 @@ public class Spring2Codegen extends AbstractJavaCodegen implements BeanValidatio
43
43
public static final String IMPLICIT_HEADERS = "implicitHeaders" ;
44
44
public static final String SWAGGER_DOCKET_CONFIG = "swaggerDocketConfig" ;
45
45
public static final String TARGET_OPENFEIGN = "generateForOpenFeign" ;
46
+ public static final String DEFAULT_INTERFACES = "defaultInterfaces" ;
46
47
47
48
protected String title = "swagger-petstore" ;
48
49
protected String configPackage = "io.swagger.configuration" ;
@@ -60,6 +61,7 @@ public class Spring2Codegen extends AbstractJavaCodegen implements BeanValidatio
60
61
protected boolean swaggerDocketConfig = false ;
61
62
protected boolean useOptional = false ;
62
63
protected boolean openFeign = false ;
64
+ protected boolean defaultInterfaces = true ;
63
65
64
66
public Spring2Codegen () {
65
67
super ();
@@ -91,6 +93,7 @@ public Spring2Codegen() {
91
93
cliOptions .add (CliOption .newBoolean (USE_OPTIONAL ,
92
94
"Use Optional container for optional parameters" ));
93
95
cliOptions .add (CliOption .newBoolean (TARGET_OPENFEIGN ,"Generate for usage with OpenFeign (instead of feign)" ));
96
+ cliOptions .add (CliOption .newBoolean (DEFAULT_INTERFACES , "Generate default implementations for interfaces" ).defaultValue ("true" ));
94
97
95
98
supportedLibraries .put (DEFAULT_LIBRARY , "Spring-boot Server application using the SpringFox integration." );
96
99
supportedLibraries .put (SPRING_MVC_LIBRARY , "Spring-MVC Server application using the SpringFox integration." );
@@ -207,6 +210,10 @@ public void processOpts() {
207
210
this .setOpenFeign (convertPropertyToBoolean (TARGET_OPENFEIGN ));
208
211
}
209
212
213
+ if (additionalProperties .containsKey (DEFAULT_INTERFACES )) {
214
+ this .setDefaultInterfaces (Boolean .valueOf (additionalProperties .get (DEFAULT_INTERFACES ).toString ()));
215
+ }
216
+
210
217
if (useBeanValidation ) {
211
218
writePropertyBack (USE_BEANVALIDATION , useBeanValidation );
212
219
}
@@ -760,4 +767,8 @@ public void setUseOptional(boolean useOptional) {
760
767
public void setOpenFeign (boolean openFeign ) {
761
768
this .openFeign = openFeign ;
762
769
}
770
+
771
+ public void setDefaultInterfaces (boolean defaultInterfaces ) {
772
+ this .defaultInterfaces = defaultInterfaces ;
773
+ }
763
774
}
0 commit comments