io.spring.initializr.metadata.InitializrMetadataProvider Java Examples
The following examples show how to use
io.spring.initializr.metadata.InitializrMetadataProvider.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectGenerationInvoker.java From initializr with Apache License 2.0 | 6 votes |
/** * Invokes the project generation API that generates the entire project structure for * the specified {@link ProjectRequest}. * @param request the project request * @return the {@link ProjectGenerationResult} */ public ProjectGenerationResult invokeProjectStructureGeneration(R request) { InitializrMetadata metadata = this.parentApplicationContext.getBean(InitializrMetadataProvider.class).get(); try { ProjectDescription description = this.requestConverter.convert(request, metadata); ProjectGenerator projectGenerator = new ProjectGenerator(( projectGenerationContext) -> customizeProjectGenerationContext(projectGenerationContext, metadata)); ProjectGenerationResult result = projectGenerator.generate(description, generateProject(request)); addTempFile(result.getRootDirectory(), result.getRootDirectory()); return result; } catch (ProjectGenerationException ex) { publishProjectFailedEvent(request, metadata, ex); throw ex; } }
Example #2
Source File: InitializrAutoConfiguration.java From initializr with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean(InitializrMetadataProvider.class) public InitializrMetadataProvider initializrMetadataProvider(InitializrProperties properties, ObjectProvider<InitializrMetadataUpdateStrategy> initializrMetadataUpdateStrategy) { InitializrMetadata metadata = InitializrMetadataBuilder.fromInitializrProperties(properties).build(); return new DefaultInitializrMetadataProvider(metadata, initializrMetadataUpdateStrategy.getIfAvailable(() -> (current) -> current)); }
Example #3
Source File: InitializrAutoConfiguration.java From initializr with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean ProjectGenerationController<ProjectRequest> projectGenerationController( InitializrMetadataProvider metadataProvider, ObjectProvider<ProjectRequestPlatformVersionTransformer> platformVersionTransformer, ApplicationContext applicationContext) { ProjectGenerationInvoker<ProjectRequest> projectGenerationInvoker = new ProjectGenerationInvoker<>( applicationContext, new DefaultProjectRequestToDescriptionConverter(platformVersionTransformer .getIfAvailable(DefaultProjectRequestPlatformVersionTransformer::new))); return new DefaultProjectGenerationController(metadataProvider, projectGenerationInvoker); }
Example #4
Source File: ProjectGenerationInvokerTests.java From initializr with Apache License 2.0 | 5 votes |
private void setupContext() { InitializrMetadataProvider metadataProvider = mock(InitializrMetadataProvider.class); given(metadataProvider.get()).willReturn(InitializrMetadataTestBuilder.withDefaults().build()); this.context = new AnnotationConfigApplicationContext(); this.context.register(TestConfiguration.class); this.context.refresh(); }
Example #5
Source File: ProjectGenerationInvoker.java From initializr with Apache License 2.0 | 5 votes |
/** * Invokes the project generation API that knows how to just write the build file. * Returns a directory containing the project for the specified * {@link ProjectRequest}. * @param request the project request * @return the generated build content */ public byte[] invokeBuildGeneration(R request) { InitializrMetadata metadata = this.parentApplicationContext.getBean(InitializrMetadataProvider.class).get(); try { ProjectDescription description = this.requestConverter.convert(request, metadata); ProjectGenerator projectGenerator = new ProjectGenerator(( projectGenerationContext) -> customizeProjectGenerationContext(projectGenerationContext, metadata)); return projectGenerator.generate(description, generateBuild(request)); } catch (ProjectGenerationException ex) { publishProjectFailedEvent(request, metadata, ex); throw ex; } }
Example #6
Source File: ProjectGenerationControllerCustomRequestIntegrationTests.java From initializr with Apache License 2.0 | 5 votes |
@Bean CustomProjectGenerationController customProjectGenerationController(InitializrMetadataProvider metadataProvider, ApplicationContext applicationContext) { ProjectGenerationInvoker<CustomProjectRequest> projectGenerationInvoker = new ProjectGenerationInvoker<>( applicationContext, new CustomProjectRequestToDescriptionConverter()); return new CustomProjectGenerationController(metadataProvider, projectGenerationInvoker); }
Example #7
Source File: InitializrAutoConfigurationTests.java From initializr with Apache License 2.0 | 5 votes |
@Test void metadataProviderWithCustomInitializrMetadataProvider() { this.contextRunner.withUserConfiguration(CustomInitializrMetadataProviderConfiguration.class).run((context) -> { assertThat(context).hasSingleBean(InitializrMetadataProvider.class); assertThat(context).hasBean("testInitializrMetadataProvider"); }); }
Example #8
Source File: InitializrConfig.java From ogham with Apache License 2.0 | 5 votes |
@Bean public InitializrMetadataProvider initializrMetadataProvider( InitializrProperties properties) { InitializrMetadata metadata = InitializrMetadataBuilder .fromInitializrProperties(properties).build(); return new SimpleInitializrMetadataProvider(metadata); }
Example #9
Source File: CustomProjectGenerationConfigurationExample.java From initializr with Apache License 2.0 | 5 votes |
@Bean public CustomProjectGenerationController projectGenerationController(InitializrMetadataProvider metadataProvider, ApplicationContext applicationContext) { ProjectGenerationInvoker<CustomProjectRequest> projectGenerationInvoker = new ProjectGenerationInvoker<>( applicationContext, new CustomProjectRequestToDescriptionConverter()); return new CustomProjectGenerationController(metadataProvider, projectGenerationInvoker); }
Example #10
Source File: InitializrAutoConfigurationTests.java From initializr with Apache License 2.0 | 4 votes |
@Test void metadataProviderWithNoMetadataUpdateStrategyRegistersDefault() { this.contextRunner.run((context) -> assertThat(context).hasSingleBean(InitializrMetadataProvider.class)); }
Example #11
Source File: CustomProjectGenerationController.java From initializr with Apache License 2.0 | 4 votes |
CustomProjectGenerationController(InitializrMetadataProvider metadataProvider, ProjectGenerationInvoker<CustomProjectRequest> projectGenerationInvoker) { super(metadataProvider, projectGenerationInvoker); }
Example #12
Source File: InitializrAutoConfigurationTests.java From initializr with Apache License 2.0 | 4 votes |
@Bean InitializrMetadataProvider testInitializrMetadataProvider() { return mock(InitializrMetadataProvider.class); }
Example #13
Source File: CustomProjectGenerationController.java From initializr with Apache License 2.0 | 4 votes |
public CustomProjectGenerationController(InitializrMetadataProvider metadataProvider, ProjectGenerationInvoker<CustomProjectRequest> projectGenerationInvoker) { super(metadataProvider, projectGenerationInvoker); }
Example #14
Source File: ProjectGenerationInvokerTests.java From initializr with Apache License 2.0 | 4 votes |
@Bean InitializrMetadataProvider initializrMetadataProvider() { return () -> metadata; }
Example #15
Source File: InitializrAutoConfiguration.java From initializr with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean SpringCliDistributionController cliDistributionController(InitializrMetadataProvider metadataProvider) { return new SpringCliDistributionController(metadataProvider); }
Example #16
Source File: InitializrAutoConfiguration.java From initializr with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean CommandLineMetadataController commandLineMetadataController(InitializrMetadataProvider metadataProvider, TemplateRenderer templateRenderer) { return new CommandLineMetadataController(metadataProvider, templateRenderer); }
Example #17
Source File: InitializrAutoConfiguration.java From initializr with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean ProjectMetadataController projectMetadataController(InitializrMetadataProvider metadataProvider, DependencyMetadataProvider dependencyMetadataProvider) { return new ProjectMetadataController(metadataProvider, dependencyMetadataProvider); }
Example #18
Source File: ProjectGenerationController.java From initializr with Apache License 2.0 | 4 votes |
public ProjectGenerationController(InitializrMetadataProvider metadataProvider, ProjectGenerationInvoker<R> projectGenerationInvoker) { this.metadataProvider = metadataProvider; this.projectGenerationInvoker = projectGenerationInvoker; }
Example #19
Source File: ProjectMetadataController.java From initializr with Apache License 2.0 | 4 votes |
public ProjectMetadataController(InitializrMetadataProvider metadataProvider, DependencyMetadataProvider dependencyMetadataProvider) { super(metadataProvider); this.dependencyMetadataProvider = dependencyMetadataProvider; }
Example #20
Source File: MetadataVerificationTests.java From start.spring.io with Apache License 2.0 | 4 votes |
MetadataVerificationTests(@Autowired InitializrMetadataProvider metadataProvider) throws IOException { this.metadata = metadataProvider.get(); }
Example #21
Source File: DefaultProjectGenerationController.java From initializr with Apache License 2.0 | 4 votes |
public DefaultProjectGenerationController(InitializrMetadataProvider metadataProvider, ProjectGenerationInvoker<ProjectRequest> projectGenerationInvoker) { super(metadataProvider, projectGenerationInvoker); }
Example #22
Source File: SpringCliDistributionController.java From initializr with Apache License 2.0 | 4 votes |
public SpringCliDistributionController(InitializrMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; }
Example #23
Source File: AbstractMetadataController.java From initializr with Apache License 2.0 | 4 votes |
protected AbstractMetadataController(InitializrMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; }
Example #24
Source File: CommandLineMetadataController.java From initializr with Apache License 2.0 | 4 votes |
public CommandLineMetadataController(InitializrMetadataProvider metadataProvider, TemplateRenderer templateRenderer) { super(metadataProvider); this.commandLineHelpGenerator = new CommandLineHelpGenerator(templateRenderer); }
Example #25
Source File: InitializrStatsAutoConfigurationTests.java From initializr with Apache License 2.0 | 4 votes |
@Bean InitializrMetadataProvider initializrMetadataProvider() { return mock(InitializrMetadataProvider.class); }
Example #26
Source File: InitializrActuatorEndpointsAutoConfiguration.java From initializr with Apache License 2.0 | 4 votes |
@Bean public DependencyRangesInfoContributor dependencyRangesInfoContributor( InitializrMetadataProvider metadataProvider) { return new DependencyRangesInfoContributor(metadataProvider); }
Example #27
Source File: InitializrActuatorEndpointsAutoConfiguration.java From initializr with Apache License 2.0 | 4 votes |
@Bean public BomRangesInfoContributor bomRangesInfoContributor(InitializrMetadataProvider metadataProvider) { return new BomRangesInfoContributor(metadataProvider); }
Example #28
Source File: InitializrStatsAutoConfiguration.java From initializr with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnBean(InitializrMetadataProvider.class) ProjectGenerationStatPublisher projectRequestStatHandler(RestTemplateBuilder restTemplateBuilder) { return new ProjectGenerationStatPublisher(new ProjectRequestDocumentFactory(), this.statsProperties, restTemplateBuilder, statsRetryTemplate()); }
Example #29
Source File: DependencyRangesInfoContributor.java From initializr with Apache License 2.0 | 4 votes |
public DependencyRangesInfoContributor(InitializrMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; }
Example #30
Source File: BomRangesInfoContributor.java From initializr with Apache License 2.0 | 4 votes |
public BomRangesInfoContributor(InitializrMetadataProvider metadataProvider) { this.metadataProvider = metadataProvider; }