Class SingleResourceProjectContributor

java.lang.Object
io.spring.initializr.generator.project.contributor.SingleResourceProjectContributor
All Implemented Interfaces:
ProjectContributor, org.springframework.core.Ordered

public class SingleResourceProjectContributor extends Object implements ProjectContributor
ProjectContributor that contributes a single file, identified by a resource pattern, to a generated project.
Author:
Andy Wilkinson
See Also:
  • PathMatchingResourcePatternResolver
  • Constructor Details

    • SingleResourceProjectContributor

      public SingleResourceProjectContributor(String relativePath, String resourcePattern)
      Create a new instance.
      Parameters:
      relativePath - the relative path in the generated structure.
      resourcePattern - the pattern to use to locate the resource to copy to the project structure
      See Also:
      • PathMatchingResourcePatternResolver.getResource(String)
  • Method Details

    • contribute

      public void contribute(Path projectRoot) throws IOException
      Description copied from interface: ProjectContributor
      Contribute additional resources to the project in the specified root directory.
      Specified by:
      contribute in interface ProjectContributor
      Parameters:
      projectRoot - the root directory of the project
      Throws:
      IOException - if contributing a resource failed