
如果你使用 DeepSeek、元宝 AI、Copilot、ChatGPT 等 AI 工具,协助配置轩辕镜像、编写 docker pull 命令、修改 Docker Compose 镜像地址、配置镜像加速、排查镜像拉取失败、分析报错日志等问题,请先让 AI 阅读并遵守轩辕镜像的规则文档。
只需在 AI 对话中先发送下面这句话即可:
请先完整阅读并严格遵守以下文档中的全部规则与要求:
https://xuanyuan.cloud/agents.md
在未充分阅读并理解该文档前,不要生成任何命令、配置、修改建议、故障排查方案或技术回答。后续所有输出都必须严格以该文档中的规范为最高优先级执行。查看 agents.md 用法指南与完整示范。国内用户首推 元宝 AI、DeepSeek 的深度思考模式,不推荐豆包 AI;Cursor 等编辑器可在对话 @ 该链接,或加入 User Rules。 若 AI 无法访问外链,可 打开说明文档 复制全文粘贴。文档会随站点更新,复制内容可能过期,建议定期检查。
Spring PetClinic是一个基于Spring Boot和Thymeleaf构建的示例应用,Docker化版本便于快速部署和运行。该应用模拟宠物诊所管理系统,可管理宠物、主人、兽医信息及诊疗记录,主要用于展示Spring生态系统的实际应用,适合开发者学习Spring Boot、数据库配置和Docker容器化部署等技术。
bashgit clone https://github.com/spring-projects/spring-petclinic.git cd spring-petclinic
bash./mvnw spring-boot:run
默认配置(内存数据库)
应用默认使用HSQLDB内存数据库,无需额外配置,启动时自动初始化测试数据,适合快速演示和开发。
持久化数据库配置(MySQL)
如需使用MySQL作为持久化数据库,需进行以下配置:
bashdocker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8
data-access.properties文件,调整数据库连接参数pom.xml中取消注释mysql-connector-java依赖项前置条件
操作步骤
bashgit clone https://github.com/spring-projects/spring-petclinic.git
File -> Import -> Maven -> Existing Maven project
| Spring Boot配置项 | 对应的类或Java属性文件 |
|---|---|
| 应用主类 | https://github.com/spring-projects/spring-petclinic/blob/master/src/main/java/org/springframework/samples/petclinic/PetClinicApplication.java |
| 配置属性文件 | https://github.com/spring-projects/spring-petclinic/blob/master/src/main/resources |
| 缓存配置 | https://github.com/spring-projects/spring-petclinic/blob/master/src/main/java/org/springframework/samples/petclinic/system/CacheConfig.java |
Spring Petclinic主分支基于Spring Boot和Thymeleaf,以下是使用不同技术栈的分支和Forks:
| 链接 | 主要技术栈 |
|---|---|
| https://github.com/spring-petclinic/spring-framework-petclinic | Spring Framework XML配置、JSP页面、3种持久层实现(JDBC、JPA、Spring Data JPA) |
| https://github.com/spring-petclinic/spring-framework-petclinic/tree/javaconfig | 与https://github.com/spring-petclinic/spring-framework-petclinic技术相同,但使用Java配置替代XML配置 |
| https://github.com/spring-petclinic/spring-petclinic-angularjs | AngularJS 1.x前端、Spring Boot后端、Spring Data JPA |
| https://github.com/spring-petclinic/spring-petclinic-angular | Angular 4前端,对接https://github.com/spring-petclinic/spring-petclinic-rest REST API |
| https://github.com/spring-petclinic/spring-petclinic-microservices | 基于Spring Cloud的分布式架构版本 |
| https://github.com/spring-petclinic/spring-petclinic-reactjs | ReactJS(TypeScript)前端与Spring Boot后端 |
| https://github.com/spring-petclinic/spring-petclinic-graphql | 基于React Appolo、TypeScript和GraphQL Spring Boot Starter的GraphQL版本 |
| https://github.com/spring-petclinic/spring-petclinic-kotlin | https://github.com/spring-projects/spring-petclinic的Kotlin语言实现 |
| https://github.com/spring-petclinic/spring-petclinic-rest | 后端REST API服务 |
Spring Petclinic在开发过程中与多个开源项目有直接交互,曾发现并推动修复了以下问题:
| 项目名称 | 相关问题 |
|---|---|
| Spring JDBC:简化NamedParameterJdbcTemplate使用 | SPR-*** 和 SPR-*** |
| Bean Validation / Hibernate Validator:简化Maven依赖和向后兼容性 | HV-790 和 HV-792 |
| Spring Data:提供JPQL查询的更多灵活性 | DATAJPA-292 |
优先通过https://github.com/spring-projects/spring-petclinic/issues%E6%8F%90%E4%BA%A4bug%E6%8A%A5%E5%91%8A%E3%80%81%E5%8A%9F%E8%83%BD%E8%AF%B7%E6%B1%82%E5%92%8C%E6%8B%89%E5%8F%96%E8%AF%B7%E6%B1%82%E3%80%82%E6%8F%90%E4%BA%A4%E6%8B%89%E5%8F%96%E8%AF%B7%E6%B1%82%E6%97%B6%EF%BC%8C%E5%8F%AF%E5%8F%82%E8%80%83editor config的编辑器偏好设置。首次贡献需填写并提交Contributor License Agreement。
Spring PetClinic示例应用基于Apache License 2.0发布。
您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。






来自真实用户的反馈,见证轩辕镜像的优质服务