title: How to override default swgger-code-gen Service implementation?
body: <p>I am new to swagger codegen and I use version 2.1.6. I am trying to generate rest service via yaml and swagger-codegen-maven.
  Below is part of pom.xml:</p>
  
  <pre><code>.....
  &lt;plugin&gt;
  &lt;groupId&gt;io.swagger&lt;/groupId&gt;
  &lt;artifactId&gt;swagger-codegen-maven-plugin&lt;/artifactId&gt;
  &lt;version&gt;${io.swagger.swagger-codegen-maven-plugin.version}&lt;/version&gt;
  &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;createprod&lt;/id&gt;
          &lt;goals&gt;
              &lt;goal&gt;generate&lt;/goal&gt;
          &lt;/goals&gt;
          &lt;configuration&gt;
              &lt;inputSpec&gt;${project.basedir}/src/main/resources/swagger/rest-api-create-product.yaml&lt;/inputSpec&gt;
              &lt;language&gt;io.swagger.codegen.languages.JavaResteasyServerCodegen&lt;/language&gt;
            &lt;!--   &lt;templateDirectory&gt;How_do_I_use_it&lt;/templateDirectory&gt; --&gt;
  
              &lt;output&gt;${project.build.directory}/generated-sources&lt;/output&gt;
              &lt;apiPackage&gt;${swagger.resourcePackage}.handler&lt;/apiPackage&gt;
              &lt;modelPackage&gt;${swagger.resourcePackage}.model&lt;/modelPackage&gt;
              &lt;invokerPackage&gt;${swagger.resourcePackage}.handler&lt;/invokerPackage&gt;
               &lt;configOptions&gt;
                   &lt;sourceFolder&gt;src/main/java&lt;/sourceFolder&gt;
                   &lt;interfaceOnly&gt;true&lt;/interfaceOnly&gt;
                   &lt;configPackage&gt;com.domain.service.configuration&lt;/configPackage&gt;
                   &lt;serializableModel&gt;true&lt;/serializableModel&gt;
               &lt;/configOptions&gt;
          &lt;/configuration&gt;
      &lt;/execution&gt;
  &lt;/executions&gt;
    &lt;/plugin&gt;
  
  &lt;plugin&gt;
      &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
      &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt;
      &lt;version&gt;1.9.1&lt;/version&gt;
      &lt;executions&gt;
          &lt;execution&gt;
              &lt;id&gt;add-source&lt;/id&gt;
              &lt;phase&gt;generate-sources&lt;/phase&gt;
              &lt;goals&gt;
                  &lt;goal&gt;add-source&lt;/goal&gt;
              &lt;/goals&gt;
              &lt;configuration&gt;
                  &lt;sources&gt;
                      &lt;source&gt;src/main/java&lt;/source&gt;
                  &lt;/sources&gt;
              &lt;/configuration&gt;
          &lt;/execution&gt;
      &lt;/executions&gt;
  &lt;/plugin&gt;
  &lt;/plugins&gt;  
  </code></pre>
  
  <p>ServiceImpl generated by swagger is:</p>
  
  <pre><code>import com.domain.servie.handler.*;
  import com.domain.servie.model.*;
  
  
  import com.domain.servie.model.InitSuccessResponse;
  import com.domain.servie.model.FailureResponse;
  import com.domain.servie.model.InitRequest;
  
  import java.util.List;
  import com.domain.servie.handler.NotFoundException;
  
  import java.io.InputStream;
  
  import javax.ws.rs.core.Response;
  import javax.ws.rs.core.SecurityContext;
  
  @javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaResteasyServerCodegen", date = "2017-01-13T12:19:29.084-06:00")
  public class InitWfApiServiceImpl extends InitWfApiService {
  
        @Override
        public Response createProductPost(String apiKey,InitRequest body,SecurityContext securityContext)
        throws NotFoundException {
        // do some magic!
        return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();
    }
  
  }
  </code></pre>
  
  <p>Here, instead of <code>return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build();</code>, I would like to map request processing to my own request handler and I don't want to hardcode it to rest api. </p>
  
  <p>The idea is, rest-api is to be reusable (jar file). The system that includes rest-api as dependency jar will take care of building war. Packaging structure is a sort of stone carved requirement given to me. :)</p>
  
  <p>Does anyone know how do I override this ServiceImpl code WITHOUT doing some crazy stuff like overriding DefaultCodeGen etc ? Is it possible to use templates to achieve this?</p>
  
  <p>Any input will be gratefully appreciated.</p>