diff --git a/Others/spring-boot/README.md b/Others/spring-boot/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0933ce4ccd288e417ad2b17d48bcb80500436274 --- /dev/null +++ b/Others/spring-boot/README.md @@ -0,0 +1,105 @@ +# Quick reference + +- The official Spring Boot docker image. + +- Maintained by: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative). + +- Where to get help: [openEuler CloudNative SIG](https://gitee.com/openeuler/cloudnative), [openEuler](https://gitee.com/openeuler/community). + +# Spring Boot | openEuler +Current Spring Boot docker images are built on the [openEuler](https://repo.openeuler.org/). This repository is free to use and exempted from per-user rate limits. + +Spring Boot is an open-source, opinionated Java framework designed to simplify the development of standalone, production-grade Spring-based applications. It extends the Spring Framework by providing features that streamline and accelerate the development process, particularly for microservices and web application + +Learn more on [Spring Boot Website](https://spring.io/projects/spring-boot)⁠. + +# Supported tags and respective Dockerfile links +The tag of each `spring-boot` docker image is consist of the version of `spring-boot` and the version of basic image. The details are as follows + +| Tag | Currently | Architectures | +|----------|-------------|------------------| +|[3.4.4-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/spring-boot/3.4.4/24.03-lts-sp1/Dockerfile)| Spring Boot 3.4.4 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +# Usage +In this usage, users can select the corresponding `{Version}` based on their requirements. + +- Add Spring Boot to your project + + **Using Maven:** + + Add the `spring-boot-starter-parent` and a `starter dependency` to your `pom.xml`: + ``` + + org.springframework.boot + spring-boot-starter-parent + ${Version} + + + + + + org.springframework.boot + spring-boot-starter-web + + + ``` + **Using Gradle:** + ``` + plugins { + id 'org.springframework.boot' version '${Version}' + } + + dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + } + ``` + +- Create an Application class + + Create a simple `application` class with a `main` method: + ``` + package com.example; + + import org.spring-boot.*; + import org.spring-boot.impl.StdSchedulerFactory; + + package com.spring.boot; + + import org.springframework.boot.SpringApplication; + import org.springframework.boot.autoconfigure.SpringBootApplication; + import org.springframework.web.bind.annotation.*; + + @SpringBootApplication + @RestController + public class Application { + + @RequestMapping("/") + public String home() { + return "Hello World!"; + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + } + ``` + +- Run the application + + Run your application from your IDE or with maven: + ``` + ./mvnw spring-boot:run + ``` + + Or with Gradle: + ``` + ./gradlew bootRun + ``` + + Open your website and visit: http://localhost:8080/, you should see: + ``` + Hello World! + ``` + +# Question and answering +If you have any questions or want to use some special features, please submit an issue or a pull request on [openeuler-docker-images](https://gitee.com/openeuler/openeuler-docker-images). \ No newline at end of file diff --git a/Others/spring-boot/doc/image-info.yml b/Others/spring-boot/doc/image-info.yml new file mode 100644 index 0000000000000000000000000000000000000000..0dbd3969f32b73ff557d46607202d7557f66629a --- /dev/null +++ b/Others/spring-boot/doc/image-info.yml @@ -0,0 +1,104 @@ +name: spring-boot +category: others +description: Spring Boot 是 Spring 官方推出的一个开源框架,用于快速构建独立、生产级别的 Spring 应用,它对原生 Spring 做了自动化配置、内嵌服务器支持、约定优于配置,大大降低了使用 Spring 的复杂度。 +environment: | + 本应用在Docker环境中运行,安装Docker执行如下命令 + ``` + yum install -y docker + ``` +tags: | + spring-boot镜像的Tag由其版本信息和基础镜像版本信息组成,详细内容如下 + + | Tag | Currently | Architectures | + |----------|-------------|------------------| + |[3.4.4-oe2403sp1](https://gitee.com/openeuler/openeuler-docker-images/blob/master/Others/spring-boot/3.4.4/24.03-lts-sp1/Dockerfile)| Spring Boot 3.4.4 on openEuler 24.03-LTS-SP1 | amd64, arm64 | + +download: | + 拉取镜像到本地 + ``` + docker pull openeuler/spring-boot:{Tag} + ``` + +usage: | + - 添加sping boot依赖到项目中 + + **使用MAVEN:** + 添加`spring-boot-starter-parent` 和 `starter dependency` 到 `pom.xml` 文件中: + ``` + + org.springframework.boot + spring-boot-starter-parent + ${Version} + + + + + + org.springframework.boot + spring-boot-starter-web + + + ``` + **使用 Gradle:** + ``` + plugins { + id 'org.springframework.boot' version '${Version}' + } + + dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + } + ``` + + - 创建一个应用类 + + 创建一个简单通过main方法启动应用的类: + ``` + package com.example; + + import org.spring-boot.*; + import org.spring-boot.impl.StdSchedulerFactory; + + package com.spring.boot; + + import org.springframework.boot.SpringApplication; + import org.springframework.boot.autoconfigure.SpringBootApplication; + import org.springframework.web.bind.annotation.*; + + @SpringBootApplication + @RestController + public class Application { + + @RequestMapping("/") + public String home() { + return "Hello World!"; + } + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + } + ``` + + - 运行应用 + + 在IDE或者MAVEN运行应用 + ``` + ./mvnw spring-boot:run + ``` + + 或者Gradle: + ``` + ./gradlew bootRun + ``` + + 打开浏览器访问: http://localhost:8080/, 你会看到: + ``` + Hello World! + ``` + +license: Apache-2.0 license +similar_packages: + - N/A +dependency: + - openjdk diff --git a/Others/spring-boot/doc/picture/logo.png b/Others/spring-boot/doc/picture/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..384b71324c281bed848cec09b594bfc58f6d6a67 Binary files /dev/null and b/Others/spring-boot/doc/picture/logo.png differ