Mac编程3-如何用Mac学习Spring官方样板项目

3 篇文章 1 订阅

官方60个样板项目逐个演示。
在这里插入图片描述

Test 1 Building a RestFul Web Service

目的:创建一个服务 http://localhost:8080/greeting. 返回一个Json
步骤:1、用https://start.spring.io/创建 Spring Web 项目并下载
2、Create a Resource Representation Class 创建资源类。
3、Create a Resource Controller 创建资源控制器。
4、生成可执行JAR.
5、测试结果

1、Building a RESTful Web Service 5分钟
目的:HTTP GET 访问http://localhost:8080/greeting.获取JSON 格式的 greeting,
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

Test 2 Scheduling Tasks

目的:组件一个应用,使用spring的@Schedule注释每5s输出一次当前时间。
步骤:1、用https://start.spring.io/创建项目并下载
2、Adding the awaitility Dependency 添加awaitility的依赖
3、Create a Scheduled Task 创建一个计划任务
4、Enable Scheduling 启用调度
5、Build an executable JAR 构建可执行的JAR

Test3 Consuming a RestFul Web Serviec

目的:使用RestTemplate接收数据
步骤:1、用https://start.spring.io/创建 Spring Web 项目。并下载
2、Fetching a REST Resource 获取REST资源。
3、Finishing the Application 完成应用
4、Running the Application 运行应用

Test4 Building Java Projects with Gradle

目的:使用Gradle构建一个简单的APP
步骤:1、Set up the project 设置项目
2、Create the directory structure 创建目录结构
3、Install Gradle 安装Gradle
4、Build Java code 构建Java 代码
5、Declare dependencies 声明依赖
6、Build your project with Gradle Wrapper 用Gradle Wrapper构建项目

Test 5 Building Java Projects with Maven

目的: 目的学习java打包
步骤:1、Set up the project 设置项目
2、Create the directory structure 创建目录结构
3、Define a simple Maven build 定义一个简单的Maven构建
4、Build Java code 构建Java 代码
5、Declare Dependencies 声明依赖
6、Write a Test 编写一个测试

Test 6 Accessing Relational Data using JDBC with Spring

目的:构建一个应用程序,使用Spring的JdbcTemplate访问存储在关联数据库中的数据
步骤:1、用https://start.spring.io/创建项目JDBC API 和 H2 Database并下载
2、Create a Customer Object 创建Customer项目
3、Store and Retrieve Data存储和检索数据
4、Build an executable JAR 创建可执行的JAR

Test 7 Uploading Files

目的:创建一个springboot应用来接收上传文档
步骤:1、用https://start.spring.io/创建 Spring Web 和 Thymeleaf 项目。并下载
2、Create an Application Class 创建应用类
3、Create a File Upload Controller 创建文件档上传控制器
4、Creating an HTML Template 创建HTML模板
5、Tuning File Upload Limits 调整文件上传限制
6、Run the Application 运行应用
7、Build an executable JAR 构建可执行的JAR
8、Testing Your Application 测试应用

Test 8 Authenticating a User with LDAP

目的:构建一个由 Spring Security 的嵌入式 Java-based LDAP 服务器保护的简单 Web 应用程序,使用包含一组用户的数据文件加载 LDAP 服务器。
步骤:1、用https://start.spring.io/创建 Spring Web 项目并下载
2、Create a Simple Web Controller创建一个简单的Web控制器
3、Build the Unsecured Web Application 构建不安全的Web应用
4、Build an executable JAR构建可执行的JAR
5、Set up Spring Security设置Spring安全配置
6、Set up User Data设置用户数据

Test 9 Messaging with Redis

目的:构建一个应用程序 使用StringRedisTemplate来发布字符串消息,并用MessageListenerAdapter用POJO订阅该消息。
步骤:1、Standing up a Redis server建立一个Redis服务器
2、用https://start.spring.io/创建 Spring Data Redis 项目并下载
3、Create a Redis Message Receiver创建一个Redis消息接收器
4、Register the Listener and Send a Message注册监听器并发送一条消息
5、Build an executable JAR构建一个可执行的JAR

Test 10 Messaging with RabbitMQ

目的:构建一个应用,使用Spring AMQP的 RabbitTemplate发布消息并用MessageListenerAdapter在POJO 上订阅消息
步骤:1、Set up the RabbitMQ Broker设置RabbitMQ Broker
2、用https://start.spring.io/创建 Spring for RabbitMQ项目并下载
3、Create a RabbitMQ Message Receiver创建一个RabbitMQ消息接收器
4、Register the Listener and Send a Message注册一个监听器并且发送消息
5、Send a Test Message发送一条测试消息
6、Run the Application运行应用程序
7、Build an executable JAR构建一个可执行的JAR

Test 11 Accessing Data with Neo4j

目的:使用Neo4j基于NoSQL图形的数据储存来组件一个嵌入式的Neo4j服务器,储存实体和关系并开发查询。
步骤:1、用https://start.spring.io/创建 Spring Data Neo4j项目并下载
2、Standing up a Neo4j Server 建立Neo4j服务器
3、Define a Simple Entity 定义一个简单的实体
4、Create Simple Queries 创建简单的查询
5、Permissions to Access Neo4j Neo4j访问权限
6、Create an Application Class 创建一个应用类
7、Build an executable JAR 构建可执行的JAR

Test 12 Validating Form Input

目的:创建一个简单的spring MVC应用,该应用接受用户输入并使用标准验证注释检查输入,也可以看到如何在屏幕上显示错误信息,以便用户可以重新输入来使它有效。
步骤:1、用https://start.spring.io/创建Spring Web, Thymeleaf, Validation项目并下载
2、Create a PersonForm Object 创建一个PersonForm对象
3、Create a Web Controller创建一个Web控制器
4、Build an HTML Front End 构建一个HTML前端
5、Run the Application运行应用程序
6、Build an executable JAR 构建可执行JAR

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

东宇科技

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值