Skip to content
AI & Agents
Skill

/spring-to-solon-skill

Expert guidance for migrating Java projects from Spring Boot / Spring Cloud to the Solon framework. Provides annotation mapping, dependency replacement, architecture differences, and step-by-step migration for IoC, Web, Data, Security, Scheduling, Validation, Cloud, and Testing.

From plugin
soloncode
2006 skills1 command

Claude Code

$ npx -y skills add opensolon/soloncode --skill spring-to-solon-skill --agent claude-code

SKILL.md

spring-to-solon-skill.SKILL.md
name: spring-to-solon-skill
description: "Expert guidance for migrating Java projects from Spring Boot / Spring Cloud to the Solon framework. Provides annotation mapping, dependency replacement, architecture differences, and step-by-step migration for IoC, Web, Data, Security, Scheduling, Validation, Cloud, and Testing. TRIGGER ONLY when the user explicitly requests a framework migration to Solon — e.g. when the user says 迁移/Spring转Solon/替换starter/去Spring依赖, or asks to rewrite application.yml → app.yml, Feign→Nami, @SpringBootTest→@SolonTest, Spring Security→solon-security-auth, validation→solon-security-validation. DO NOT TRIGGER when developing, debugging, refactoring, reviewing, or adding features to a Spring project the user intends to keep: a Spring project's mere existence (Spring annotations/dependencies/config present) is NOT a migration request — never convert, fix, or Solon-ify a project's framework without the user's explicit request; if intent is unclear, ask first and keep the project on Spring. Not for greenfield Solon apps (use solon-development-skill)."

Spring to Solon Migration Skill

为将 **Spring Boot** / **Spring Cloud** 项目迁移到 **Solon 框架** 提供专家指导。Solon 是独立的 Java 企业框架(**不基于 Spring**),开发体验相近,但注解、架构与生态不同。

**官方对照**: https://solon.noear.org/article/compare-springboot **Cloud 对照**: https://solon.noear.org/article/compare-springcloud **官网**: https://solon.noear.org **当前版本**: **4.0.3**

> **版本声明**:本文档所有示例基于 Solon **4.0.3**(最后一次确认: 2026-07)。如需迁移到其他版本,请调整对应版本号。Solon 高版本保持向后兼容,通常仅需修改 `solon-parent` 版本号即可。reference 内写「跟随 SKILL 目标版本」时,以本节为准。

Critical Migration Rules

0. **意图闸门(优先于一切)**:本 skill 仅在用户**明确要求**将 Spring 项目迁移到 Solon 时适用(明确表述:迁移 / Spring转Solon / 替换 starter / 去 Spring 依赖等,或明确要求换框架)。用户未明确要求时:保持项目现有框架(Spring),禁止修改 pom 依赖、启动类、配置文件名与注解体系;不要把「项目里存在 Spring 依赖」当作迁移请求;意图不明确时先询问,不得动手。其他规则均以此条为前提。 1. **Solon 不是 Spring。** 禁止混用 Spring 注解与 Solon 注解。替换全部 Spring import。(仅在 Rule 0 确认后执行) 2. **禁止 Spring 依赖。** 移除所有 `spring-boot-starter-*`、`spring-*`。Solon 使用 `org.noear` groupId。(仅在 Rule 0 确认后执行;未确认前任何 Spring 依赖都不是“待清理项”) 3. **配置文件**是 `app.yml`(或 `app.properties`),**不是** `application.yml`。 4. **入口**是 `Solon.start(App.class, args)`,不是 `SpringApplication.run()`。 5. **Parent POM** 是 `solon-parent`(`groupId=org.noear`)。 6. **包扫描**在主类用 `@Import` / 主类包路径,不是 `@ComponentScan`。 7. **无 setter 注入。** Solon 只支持字段注入与构造器注入;构造器参数必须显式 `@Inject`。 8. **组件用 `@Component`**,不要用 `@Service` / `@Repository`。 9. **所有示例目标 Solon 4.0.x**(默认 **4.0.3**),除非用户指定其它版本。 10. **中文支持。** 用户使用中文时,回复与代码注释使用中文。 11. **不确定的 API 不要臆造。** 对照本 skill reference;Solon 原生细节查 `solon-development-skill`。 12. **校验坐标** 为 **`solon-security-validation`**(不是 `solon-validation`)。类级启用 `@Valid`,实体参数/字段用 `@Validated`。 13. **调度选型**:单机 → `@Scheduled`(`scheduling_migration.md`);分布式防重 → `@CloudJob`(`cloud_observability_migration.md`)。勿一律替换。

与 solon-development-skill 的边界

| 场景 | 使用 skill | |------|------------| | 用户明确要求 Spring → Solon 对照、替换、迁移步骤 | **本 skill** | | 纯 Solon 新功能 / AI / Flow / 最佳实践 | **solon-development-skill** | | 两边都提及时 | 先按本 skill 完成迁移对照,再链开发 skill 补原生写法 | | 用户未要求迁移,只是在 Spring 项目里干活 | **都不用**;保持 Spring 现状,意图不明先问 |

执行流程

0. **确认迁移意图(Step 0,必须最先做)**:仅当用户明确要求迁移时才进入本流程;若意图不明(如只是提到 Spring、依赖报错、想优化性能),先向用户确认,未确认前禁止改动 pom / 启动类 / 配置文件。本项目确属 Spring 且用户要继续用 → 不适用本 skill,直接按 Spring 方式干活。 1. **扫项目**:父 POM、starter 列表、配置文件名、启动类、测试入口、是否有 Security / Validation / Scheduling / Cloud。 2. **按 Checklist Step 1→12** 推进;每步只 `read` 1~2 个 reference,避免一次加载全部。 3. **生成代码前**核对 Critical Migration Rules(尤其:`app.yml`、无 Spring 混用、`@Component`/`@Inject`、校验坐标)。 4. **数据层**优先 `datasource_orm_migration.md`(含 `solon.dataSources`、SqlUtils、`@Db`)。 5. **安全**优先 `security_migration.md`(不要复刻完整 Spring Security 过滤器链)。 6. **校验**优先 `validation_migration.md`(与 `web_advanced` 摘要冲突时以 validation 文为准)。 7. **迁移完成后**的 Solon 深化(AI/Flow/进阶 API)交给 `solon-development-skill`。

Migration Scene Navigation

> 根据迁移场景读取对应 reference。**大表加载策略**: > - `annotation_mapping.md`:优先 **§12 完整速查表** 或目录中的单节;长 Before/After 去各 `*_migration.md`。 > - `dependency_mapping.md`:优先 **§3 速查表** + §1/§2;仅抄 POM 时读 §5。 > - 数据层:`datasource_orm`(源/ORM 权威)与 `transaction_cache`(事务/缓存/Redis)职责已拆分,勿混读后互相覆盖。

快速对照

| Scenario | Reference File | Grep Keywords | |---|---|---| | 注解替换对照表 / Spring→Solon 注解映射 | `references/annotation_mapping.md` | `@Autowired`, `@Inject`, `@RequestMapping`, `@Mapping`, `@Service`, `@Component`, `@Value` | | Maven 依赖替换 / starter → solon 插件 / POM | `references/dependency_mapping.md` | `pom.xml`, `spring-boot-starter`, `solon-web`, `solon-lib`, `solon-parent` |

IoC / AOP / 配置

| Scenario | Reference File | Grep Keywords | |---|---|---| | IoC / DI / 组件 / 作用域 / 生命周期 / AOP / 事件 | `references/ioc_aop_migration.md` | `@Inject`, `@Configuration`, `@Bean`, `LifecycleBean`, `@Init`, `@Destroy`, `@Aspect`, `EventBus` | | 配置文件 / 属性注入 / 配置类 / 条件装配 | `references/config_system_migration.md` | `app.yml`, `@Inject("${")`, `@Configuration`, `@Bean`, `@Condition`, `solon.config` |

Web 层迁移

| Scenario | Reference File | Grep Keywords | |---|---|---| | Controller / 请求参数 / 返回值 / Context | `references/web_controller_migration.md` | `@Controller`, `@RestController`, `@Mapping`, `@Param`, `@Body`, `Context` | | Filter / Interceptor / 全局异常 / CORS | `references/web_filter_interceptor_migration.md` | `Filter`, `RouterInterceptor`, `@ControllerAdvice`, `GlobalExceptionFilter`, `@CrossOrigin` | | 上传下载 / SSE / WebSocket / 会话 | `references/web_advanced_migration.md` | `UploadedFile`, `SseEmitter`, `WebSocket`, `SessionState` | | 参数校验 / 自定义校验 / 错误处理 | `references/validation_migration.md` | `@Valid`, `@Validated`, `@NotNull`, `ValidatorException`, `solon-security-validation` |

数据访问迁移

| Scenario | Reference File | Grep Keywords | |---|---|---| | 数据源 / SqlUtils / MyBatis / Plus / JPA / 多数据源 | `references/datasource_orm_migration.md` | `@Db`, `SqlUtils`, `solon.dataSources`, `jdbcUrl`, `MyBatis`, `JdbcTemplate` | | 事务 / 缓存 / Redis | `references/transaction_cache_migration.md` | `@Transaction`, `@Cache

Read more
@opensolon
Ships withsoloncode

The open source coding agent.

Stars on GitHub

Momentum

stars in total
200
Star history of opensolon/soloncode on GitHub, a chart by star-history.com

Other skills on soloncode.

agent-browser

agent-browser

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling…

@opensolon@opensolonInstall Skill
find-skills

find-skills

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a…

@opensolon@opensolonInstall Skill
skill-creator

skill-creator

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing…

@opensolon@opensolonInstall Skill
solon-development-skill

solon-development-skil…

Solon Java framework expert (NOT Spring). Use ONLY for projects already using or being newly built with the Solon framework. DO…

@opensolon@opensolonInstall Skill
soloncode-skin-skill

soloncode-skin-skill

Generate installable SolonCode Web UI skin zip packages from natural-language design requests. Use when the user asks to…

@opensolon@opensolonInstall Skill

More skills from other plugins.

1password

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

openclaw2w393k
@openclaw@openclawInstall Skill

Questions about spring-to-solon-skill.

Which coding agents can use spring-to-solon-skill?
spring-to-solon-skill installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.