As an enterprise we would like to host the initializr internally on our PCF instance, which I can do. I\'ve also been able to modify application.yml to default some of the selec
There is a reference guide that walk you through the creation of your own instance. Regarding your main questions:
Yes this is possible in a custom instance. Implement ProjectRequestPostProcessor
and add those two dependencies to the project.
@Component
class PreselectedDependenciesRequestPostProcessor implements ProjectRequestPostProcessor {
private final InitializrMetadataProvider metadataProvider;
public PreselectedDependenciesRequestPostProcessor(
InitializrMetadataProvider metadataProvider) {
this.metadataProvider = metadataProvider;
}
@Override
public void postProcessAfterResolution(ProjectRequest request,
InitializrMetadata metadata) {
DependenciesCapability dependencies = metadataProvider.get().getDependencies();
if (!hasDependencies(request, "web")) {
request.getResolvedDependencies().add(dependencies.get("web"));
}
if (!hasDependencies(request, "security")) {
request.getResolvedDependencies().add(dependencies.get("security"));
}
}
private boolean hasDependencies(ProjectRequest request, String... dependenciesId) {
for (String id : dependenciesId) {
if (getDependency(request, id) == null) {
return false;
}
}
return true;
}
private Dependency getDependency(ProjectRequest request, String id) {
return request.getResolvedDependencies().stream()
.filter(d -> id.equals(d.getId())).findFirst().orElse(null);
}
}
They won't be selected in the UI but they'll be integrated in the project the same way as if the user had selected them. The reason why I recommend this approach is that your custom instance can be targeted by the IDE integration the same way as the main (start.spring.io) instance. Hacking the web UI will only make this work with that particular client which, IMO, is a problem.
For the second question, most forks extend from ProjectGenerator
and do whatever they want (including overriding the gradle build). Check that class for more details.
Spring Initializr hasn't reached 1.0 yet so it's not in a state where the contract is mature enough.