Skip to content

Commit d9cd927

Browse files
committed
Merge branch 'mh/tanzu-enterprise-extensions'
Closes gh-1739
2 parents 1ec05d3 + 4e89642 commit d9cd927

File tree

8 files changed

+306
-1
lines changed

8 files changed

+306
-1
lines changed

start-site-verification/src/test/java/io/spring/start/site/MetadataVerificationTests.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import java.util.HashMap;
2222
import java.util.List;
2323
import java.util.Map;
24+
import java.util.Set;
2425
import java.util.function.Consumer;
2526
import java.util.stream.Stream;
2627

@@ -53,13 +54,23 @@
5354
* Tests to verify the validity of the metadata.
5455
*
5556
* @author Andy Wilkinson
57+
* @author Moritz Halbritter
5658
*/
5759
@SpringBootTest
5860
@TestInstance(Lifecycle.PER_CLASS)
5961
@Execution(ExecutionMode.CONCURRENT)
6062
@ActiveProfiles("test")
6163
class MetadataVerificationTests {
6264

65+
private static final Set<String> IGNORED_DEPENDENCIES = Set.of(
66+
"com.vmware.tanzu.spring.governance:governance-starter",
67+
"com.vmware.tanzu.springcloudgateway.extensions:access-control",
68+
"com.vmware.tanzu.springcloudgateway.extensions:custom",
69+
"com.vmware.tanzu.springcloudgateway.extensions:graphql",
70+
"com.vmware.tanzu.springcloudgateway.extensions:sso",
71+
"com.vmware.tanzu.springcloudgateway.extensions:traffic-control",
72+
"com.vmware.tanzu.springcloudgateway.extensions:transformation");
73+
6374
private final InitializrMetadata metadata;
6475

6576
MetadataVerificationTests(@Autowired InitializrMetadataProvider metadataProvider) {
@@ -169,7 +180,16 @@ private Collection<DependencyGroup> groups() {
169180
}
170181

171182
private Collection<Dependency> dependenciesForBootVersion(DependencyGroup group, Version bootVersion) {
172-
return group.getContent().stream().filter((dependency) -> dependency.match(bootVersion)).toList();
183+
return group.getContent()
184+
.stream()
185+
.filter((dependency) -> !isIgnored(dependency))
186+
.filter((dependency) -> dependency.match(bootVersion))
187+
.toList();
188+
}
189+
190+
private boolean isIgnored(Dependency dependency) {
191+
String coordinates = "%s:%s".formatted(dependency.getGroupId(), dependency.getArtifactId());
192+
return IGNORED_DEPENDENCIES.contains(coordinates);
173193
}
174194

175195
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.spring.start.site.extension.dependency.tanzu.spring.enterprise;
18+
19+
import java.util.Collections;
20+
21+
import io.spring.initializr.generator.buildsystem.Build;
22+
import io.spring.initializr.generator.io.template.MustacheTemplateRenderer;
23+
import io.spring.initializr.generator.io.text.MustacheSection;
24+
import io.spring.initializr.generator.project.ProjectDescription;
25+
import io.spring.initializr.generator.spring.build.BuildMetadataResolver;
26+
import io.spring.initializr.generator.spring.documentation.HelpDocument;
27+
import io.spring.initializr.generator.spring.documentation.HelpDocumentCustomizer;
28+
import io.spring.initializr.metadata.InitializrMetadata;
29+
30+
/**
31+
* {@link HelpDocumentCustomizer} to add a VMware Tanzu Spring Enterprise section to the
32+
* help file if the project has the {@code tanzu-spring-enterprise} facet.
33+
*
34+
* @author Moritz Halbritter
35+
*/
36+
class TanzuEnterpriseHelpDocumentCustomizer implements HelpDocumentCustomizer {
37+
38+
private final BuildMetadataResolver buildResolver;
39+
40+
private final MustacheTemplateRenderer templateRenderer;
41+
42+
private final Build build;
43+
44+
TanzuEnterpriseHelpDocumentCustomizer(InitializrMetadata metadata, ProjectDescription description,
45+
MustacheTemplateRenderer templateRenderer, Build build) {
46+
this.buildResolver = new BuildMetadataResolver(metadata, description.getPlatformVersion());
47+
this.build = build;
48+
this.templateRenderer = templateRenderer;
49+
}
50+
51+
@Override
52+
public void customize(HelpDocument document) {
53+
if (!hasFacet()) {
54+
return;
55+
}
56+
document
57+
.addSection(new MustacheSection(this.templateRenderer, "tanzu-spring-enterprise", Collections.emptyMap()));
58+
}
59+
60+
private boolean hasFacet() {
61+
return this.buildResolver.hasFacet(this.build, "tanzu-spring-enterprise");
62+
}
63+
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.spring.start.site.extension.dependency.tanzu.spring.enterprise;
18+
19+
import io.spring.initializr.generator.buildsystem.Build;
20+
import io.spring.initializr.generator.io.template.MustacheTemplateRenderer;
21+
import io.spring.initializr.generator.project.ProjectDescription;
22+
import io.spring.initializr.generator.project.ProjectGenerationConfiguration;
23+
import io.spring.initializr.metadata.InitializrMetadata;
24+
25+
import org.springframework.context.annotation.Bean;
26+
27+
/**
28+
* {@link ProjectGenerationConfiguration Project generation configuration} for VMware
29+
* Tanzu Spring Enterprise extensions.
30+
*
31+
* @author Moritz Halbritter
32+
*/
33+
@ProjectGenerationConfiguration
34+
class TanzuEnterpriseProjectGenerationConfiguration {
35+
36+
@Bean
37+
TanzuEnterpriseHelpDocumentCustomizer tanzuEnterpriseHelpDocumentCustomizer(InitializrMetadata metadata,
38+
ProjectDescription description, MustacheTemplateRenderer templateRenderer, Build build) {
39+
return new TanzuEnterpriseHelpDocumentCustomizer(metadata, description, templateRenderer, build);
40+
}
41+
42+
@Bean
43+
TanzuEnterpriseScgExtensionsBuildCustomizer tanzuEnterpriseScgExtensionsBuildCustomizer() {
44+
return new TanzuEnterpriseScgExtensionsBuildCustomizer();
45+
}
46+
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.spring.start.site.extension.dependency.tanzu.spring.enterprise;
18+
19+
import java.util.Set;
20+
21+
import io.spring.initializr.generator.buildsystem.Build;
22+
import io.spring.initializr.generator.spring.build.BuildCustomizer;
23+
24+
/**
25+
* {@link BuildCustomizer} to add the 'cloud-gateway-reactive' dependency if at least one
26+
* of the Tanzu Spring Enterprise Spring Cloud Gateway extensions is selected.
27+
*
28+
* @author Moritz Halbritter
29+
*/
30+
class TanzuEnterpriseScgExtensionsBuildCustomizer implements BuildCustomizer<Build> {
31+
32+
private static final Set<String> EXTENSION_DEPENDENCIES = Set.of("tanzu-scg-access-control", "tanzu-scg-custom",
33+
"tanzu-scg-graphql", "tanzu-scg-sso", "tanzu-scg-traffic-control", "tanzu-scg-transformation");
34+
35+
@Override
36+
public void customize(Build build) {
37+
if (!hasExtensionDependency(build)) {
38+
return;
39+
}
40+
addScgIfNecessary(build);
41+
}
42+
43+
private void addScgIfNecessary(Build build) {
44+
if (!build.dependencies().has("cloud-gateway-reactive")) {
45+
build.dependencies().add("cloud-gateway-reactive");
46+
}
47+
}
48+
49+
private boolean hasExtensionDependency(Build build) {
50+
for (String extensionDependency : EXTENSION_DEPENDENCIES) {
51+
if (build.dependencies().has(extensionDependency)) {
52+
return true;
53+
}
54+
}
55+
return false;
56+
}
57+
58+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright 2012-2025 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
/**
18+
* Extensions for generation of projects that depend on VMware Tanzu Spring Enterprise
19+
* extensions.
20+
*
21+
* @author Moritz Halbritter
22+
*/
23+
package io.spring.start.site.extension.dependency.tanzu.spring.enterprise;

start-site/src/main/resources/META-INF/spring.factories

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ io.spring.start.site.extension.dependency.springmodulith.SpringModulithProjectGe
5151
io.spring.start.site.extension.dependency.springpulsar.SpringPulsarProjectGenerationConfiguration,\
5252
io.spring.start.site.extension.dependency.springrestdocs.SpringRestDocsProjectGenerationConfiguration,\
5353
io.spring.start.site.extension.dependency.sqlserver.SqlServerProjectGenerationConfiguration,\
54+
io.spring.start.site.extension.dependency.tanzu.spring.enterprise.TanzuEnterpriseProjectGenerationConfiguration,\
5455
io.spring.start.site.extension.dependency.testcontainers.TestcontainersProjectGenerationConfiguration,\
5556
io.spring.start.site.extension.dependency.vaadin.VaadinProjectGenerationConfiguration,\
5657
io.spring.start.site.extension.dependency.zipkin.ZipkinProjectGenerationConfiguration,\

start-site/src/main/resources/application.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,13 @@ initializr:
151151
mappings:
152152
- compatibilityRange: "[3.3.0,3.5.0-M1)"
153153
version: 3.4.0
154+
tanzu-scg-extensions:
155+
groupId: com.vmware.tanzu.springcloudgateway.extensions
156+
artifactId: extensions-bom
157+
versionProperty: tanzu-scg-extensions.version
158+
mappings:
159+
- compatibilityRange: "[3.3.0,3.5.0-M1)"
160+
version: 1.0.0
154161
timefold-solver:
155162
groupId: ai.timefold.solver
156163
artifactId: timefold-solver-bom
@@ -1351,6 +1358,86 @@ initializr:
13511358
links:
13521359
- rel: reference
13531360
href: https://docs.vmware.com/en/Spring-Cloud-Services-for-VMware-Tanzu/index.html
1361+
- name: VMware Tanzu Spring Enterprise Extensions
1362+
compatibilityRange: "[3.3.0,3.5.0-M1)"
1363+
content:
1364+
- name: Governance Starter [Enterprise]
1365+
id: tanzu-governance-starter
1366+
description: The Enterprise Spring Boot Governance Starter library enforces cipher and TLS security based on the industry standard, and empowers Spring developers to auto-generate compliance and governance reporting information for their applications.
1367+
groupId: com.vmware.tanzu.spring.governance
1368+
artifactId: governance-starter
1369+
version: 1.3.1
1370+
facets:
1371+
- tanzu-spring-enterprise
1372+
links:
1373+
- rel: reference
1374+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/tanzu-spring/commercial/spring-tanzu/index-sbgs.html
1375+
- name: Spring Cloud Gateway Access Control [Enterprise]
1376+
id: tanzu-scg-access-control
1377+
bom: tanzu-scg-extensions
1378+
description: Spring Cloud Gateway filters for access control based on API keys or JWT Tokens.
1379+
groupId: com.vmware.tanzu.springcloudgateway.extensions
1380+
artifactId: access-control
1381+
facets:
1382+
- tanzu-spring-enterprise
1383+
links:
1384+
- rel: reference
1385+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/spring-cloud-gateway-extensions/1-0-0/scg-extensions/access-control.html
1386+
- name: Spring Cloud Gateway Custom [Enterprise]
1387+
id: tanzu-scg-custom
1388+
bom: tanzu-scg-extensions
1389+
description: Spring Cloud Gateway filters to help develop custom filters.
1390+
groupId: com.vmware.tanzu.springcloudgateway.extensions
1391+
artifactId: custom
1392+
facets:
1393+
- tanzu-spring-enterprise
1394+
links:
1395+
- rel: reference
1396+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/spring-cloud-gateway-extensions/1-0-0/scg-extensions/custom.html
1397+
- name: Spring Cloud Gateway GraphQL [Enterprise]
1398+
id: tanzu-scg-graphql
1399+
bom: tanzu-scg-extensions
1400+
description: Spring Cloud Gateway filters to restrict GraphQL operations.
1401+
groupId: com.vmware.tanzu.springcloudgateway.extensions
1402+
artifactId: graphql
1403+
facets:
1404+
- tanzu-spring-enterprise
1405+
links:
1406+
- rel: reference
1407+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/spring-cloud-gateway-extensions/1-0-0/scg-extensions/graphql.html
1408+
- name: Spring Cloud Gateway Single Sign On [Enterprise]
1409+
id: tanzu-scg-sso
1410+
bom: tanzu-scg-extensions
1411+
description: Spring Cloud Gateway filters to add single sign-on (SSO) and restrict traffic based on roles or scopes.
1412+
groupId: com.vmware.tanzu.springcloudgateway.extensions
1413+
artifactId: sso
1414+
facets:
1415+
- tanzu-spring-enterprise
1416+
links:
1417+
- rel: reference
1418+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/spring-cloud-gateway-extensions/1-0-0/scg-extensions/sso.html
1419+
- name: Spring Cloud Gateway Traffic Control [Enterprise]
1420+
id: tanzu-scg-traffic-control
1421+
bom: tanzu-scg-extensions
1422+
description: Spring Cloud Gateway filters to restrict traffic based on request parameters and add circuit breakers.
1423+
groupId: com.vmware.tanzu.springcloudgateway.extensions
1424+
artifactId: traffic-control
1425+
facets:
1426+
- tanzu-spring-enterprise
1427+
links:
1428+
- rel: reference
1429+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/spring-cloud-gateway-extensions/1-0-0/scg-extensions/traffic-control.html
1430+
- name: Spring Cloud Gateway Transformation [Enterprise]
1431+
id: tanzu-scg-transformation
1432+
bom: tanzu-scg-extensions
1433+
description: Spring Cloud Gateway filters to transform the response before returning downstream.
1434+
groupId: com.vmware.tanzu.springcloudgateway.extensions
1435+
artifactId: transformation
1436+
facets:
1437+
- tanzu-spring-enterprise
1438+
links:
1439+
- rel: reference
1440+
href: https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/spring-cloud-gateway-extensions/1-0-0/scg-extensions/transformation.html
13541441
- name: Microsoft Azure
13551442
bom: spring-cloud-azure
13561443
compatibilityRange: "[3.3.0,3.5.0-M1)"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## VMware Tanzu Spring Enterprise Extensions
2+
3+
You have selected to add [Tanzu Spring](https://www.vmware.com/products/app-platform/tanzu-spring) enterprise extensions to your project.
4+
In order to use these enterprise extensions you must have authorized [access to the Spring Enterprise Subscription](https://techdocs.broadcom.com/us/en/vmware-tanzu/spring/tanzu-spring/commercial/spring-tanzu/guide-artifact-repository-administrators.html) artifacts with an entitlement to Tanzu Spring.
5+
To learn more about what is included with Tanzu Spring entitlement, check out [enterprise.spring.io](https://enterprise.spring.io/) for more information.

0 commit comments

Comments
 (0)