@@ -62,6 +62,7 @@ public class SpringCodegen extends AbstractJavaCodegen implements BeanValidation
62
62
public static final String IMPLICIT_HEADERS = "implicitHeaders" ;
63
63
public static final String SWAGGER_DOCKET_CONFIG = "swaggerDocketConfig" ;
64
64
public static final String TARGET_OPENFEIGN = "generateForOpenFeign" ;
65
+ public static final String DEFAULT_INTERFACES = "defaultInterfaces" ;
65
66
66
67
protected String title = "swagger-petstore" ;
67
68
protected String configPackage = "io.swagger.configuration" ;
@@ -79,6 +80,7 @@ public class SpringCodegen extends AbstractJavaCodegen implements BeanValidation
79
80
protected boolean swaggerDocketConfig = false ;
80
81
protected boolean useOptional = false ;
81
82
protected boolean openFeign = false ;
83
+ protected boolean defaultInterfaces = true ;
82
84
83
85
public SpringCodegen () {
84
86
super ();
@@ -110,6 +112,7 @@ public SpringCodegen() {
110
112
cliOptions .add (CliOption .newBoolean (USE_OPTIONAL ,
111
113
"Use Optional container for optional parameters" ));
112
114
cliOptions .add (CliOption .newBoolean (TARGET_OPENFEIGN ,"Generate for usage with OpenFeign (instead of feign)" ));
115
+ cliOptions .add (CliOption .newBoolean (DEFAULT_INTERFACES , "Generate default implementations for interfaces" ).defaultValue ("true" ));
113
116
114
117
supportedLibraries .put (DEFAULT_LIBRARY , "Spring-boot Server application using the SpringFox integration." );
115
118
supportedLibraries .put (SPRING_MVC_LIBRARY , "Spring-MVC Server application using the SpringFox integration." );
@@ -226,6 +229,11 @@ public void processOpts() {
226
229
this .setOpenFeign (convertPropertyToBoolean (TARGET_OPENFEIGN ));
227
230
}
228
231
232
+ if (additionalProperties .containsKey (DEFAULT_INTERFACES )) {
233
+ this .setDefaultInterfaces (Boolean .valueOf (additionalProperties .get (DEFAULT_INTERFACES ).toString ()));
234
+ additionalProperties .put (DEFAULT_INTERFACES , this .defaultInterfaces );
235
+ }
236
+
229
237
if (useBeanValidation ) {
230
238
writePropertyBack (USE_BEANVALIDATION , useBeanValidation );
231
239
}
@@ -779,4 +787,8 @@ public void setUseOptional(boolean useOptional) {
779
787
public void setOpenFeign (boolean openFeign ) {
780
788
this .openFeign = openFeign ;
781
789
}
790
+
791
+ public void setDefaultInterfaces (boolean defaultInterfaces ) {
792
+ this .defaultInterfaces = defaultInterfaces ;
793
+ }
782
794
}
0 commit comments