Boost Your Spring Boot Projects with Alibaba’s start.aliyun.com – A Complete Guide
This article explains how Alibaba’s start.aliyun.com extends Spring Initializr to provide ready‑made demos, configuration samples, and component integration for Spring Boot, covering background, basic usage, configuration of dependencies, version ranges, BOM management, caching, and advanced customization, with full code examples and diagrams.
Background
Spring Initializr (start.spring.io) is a popular tool for bootstrapping Spring Boot projects. Alibaba has added Nacos and Sentinel to its component list and further built start.aliyun.com to supply demo code and usage instructions for each component, reducing the effort developers spend searching for correct versions and examples.
Features of start.aliyun.com
Provides individual DemoCode and configuration samples for each component.
Includes built‑in documentation to ease component discovery.
Adopts a "subtract" approach – developers only need to add what they need.
Offers multi‑component integration solutions (in development).
Regularly syncs with start.spring.io to keep up‑to‑date with Spring Boot releases.
Usage
Basic Usage
Import the Initializr BOM to avoid managing individual component versions.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.initializr</groupId>
<artifactId>initializr-bom</artifactId>
<version>0.9.0.BUILD-SNAPSHOT</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>Configuration
All configuration is placed under initializr in application.yml.
initializr:
packagings:
- name: Jar
id: jar
default: true
- name: War
id: war
default: false
javaVersions:
- id: 13
default: false
- id: 11
default: false
- id: 1.8
name: 8
default: true
languages:
- name: Java
id: java
default: true
- name: Kotlin
id: kotlin
default: false
- name: Groovy
id: groovy
default: falseDependency Definition
Dependencies are grouped for easier display. Each component defines id, groupId, artifactId, name, description and optional version.
initializr:
dependencies:
- name: Web
content:
- name: Web
id: web
description: Full‑stack web development with Tomcat and Spring MVC
- name: Developer Tools
content:
- name: Spring Boot DevTools
id: devtools
groupId: org.springframework.boot
artifactId: spring-boot-devtools
description: Provides fast application restarts, LiveReload, and configurations for enhanced development experience.
- name: Lombok
id: lombok
groupId: org.projectlombok
artifactId: lombok
description: Java annotation library which helps to reduce boilerplate code.Version Range
Version ranges use inclusive [] or exclusive () brackets. Example: [1.1.6.RELEASE,1.3.0.M1) includes 1.1.6.RELEASE but excludes 1.3.0.M1. A single version like 1.2.0.RELEASE means that version and any later releases. The placeholder x denotes the latest patch, e.g., 1.4.x.BUILD-SNAPSHOT.
Compatibility Range
Components can declare the Spring Boot versions they support.
initializr:
dependencies:
- name: Stuff
content:
- name: Foo
id: foo
compatibilityRange: 1.2.0.M1
- name: Bar
id: bar
compatibilityRange: "[1.5.0.RC1,2.0.0.M1)"BOM Management
Define a BOM under initializr.env.boms and reference it in a component.
initializr:
env:
boms:
my-api-bom:
groupId: org.acme
artifactId: my-api-dependencies
version: 1.0.0.RELEASE
repositories: my-api-repo-1 initializr:
dependencies:
- name: Other
content:
- name: My API
id: my-api
groupId: org.acme
artifactId: my-api
bom: my-api-bomAdvanced Customization
Enable Caching
Add cache dependencies and annotate the main class.
<dependency>
<groupId>javax.cache</groupId>
<artifactId>cache-api</artifactId>
</dependency>
<dependency>
<groupId>org.ehcache</groupId>
<artifactId>ehcache</artifactId>
</dependency> @EnableCachingCache keys used by Initializr:
initializr.metadata – full service metadata.
initializr.dependency-metadata – component metadata.
initializr.templates – template files for project generation.
Adding Demo Code
Register a custom ProjectGenerationConfiguration via spring.factories and implement a ProjectContributor that writes demo sources.
io.spring.initializr.generator.project.ProjectGenerationConfiguration=\
com.alibaba.alicloud.initializr.extension.dependency.springboot.SpringCloudProjectGenerationConfiguration @ProjectGenerationConfiguration
public class SpringCloudAlibabaProjectGenerationConfiguration {
// beans and contributors omitted for brevity
} @Bean
@ConditionalOnRequestedDependency("sca-oss")
public OSSDemoCodeContributor ossContributor() {
return new OSSDemoCodeContributor(description, templateRenderer);
}Principles
Startup Phase
The core SPI loaded at startup is
io.spring.initializr.web.autoconfigure.InitializrAutoConfiguration. It creates beans for metadata providers, template rendering, directory factories, and the MVC controllers that expose the generation endpoints.
Generation Phase
For each request a new ProjectGenerationContext (a child ApplicationContext) is created. The context registers a ProjectDescription provider, loads all ProjectGenerationConfiguration classes via spring.factories, and finally invokes ProjectAssetGenerator.generate(), which aggregates all ProjectContributor implementations to write files.
Extension Points
Two main extension mechanisms are provided:
ProjectContributor – receives the project root path and writes files (e.g., Maven pom, source code, resources).
Customizer – modifies objects such as ProjectDescription, build files, or source code before contributors run. Notable customizers include:
MainApplicationTypeCustomizer
MainSourceCodeCustomizer
BuildCustomizer
GitIgnoreCustomizer
HelpDocumentCustomizer
InitializrMetadataCustomizer
ProjectDescriptionCustomizer
ServletInitializerCustomizer
TestSourceCodeCustomizer
References
https://docs.spring.io/initializr/docs/current-SNAPSHOT/reference/html/ – Initializr documentation
https://github.com/spring-io/initializr – Spring Initializr source code
https://github.com/spring-io/start.spring.io – start.spring.io source code
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
