专栏名称: 纯洁的微笑
分享微服务实践与Java技术干货、偶尔讲讲故事。在人工智能的时代,一起学习微服务架构演进和大数据治理。
今天看啥  ›  专栏  ›  纯洁的微笑

使用 Docker 部署 Spring Boot 项目

纯洁的微笑  · 公众号  ·  · 2019-11-04 09:09
Docker 技术发展为微服务落地提供了更加便利的环境,使用 Docker 部署 Spring Boot 其实非常简单,这篇文章我们就来简单学习下。首先构建一个简单的 Spring Boot 项目,然后给项目添加 Docker 支持,最后对项目进行部署。一个简单 Spring Boot 项目在 pom.xml 中 ,使用 Spring Boot 2.0 相关依赖parent> groupId>org.springframework.bootgroupId> artifactId>spring-boot-starter-parentartifactId> version>2.0.0.RELEASEversion>parent>添加 web 和测试依赖dependencies> dependency> groupId>org.springframework.bootgroupId> artifactId>spring-boot-starter-webartifactId> dependency> dependency> groupId>org.springframework.bootgroupId> artifactId>spring-boot-starter-testartifactId> scope>testscope> dependency>dependencies>创建一个 DockerController,在其中有一个index()方法,访问时返回:Hello ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照