diff --git a/docs/spring-boot/30.md b/docs/spring-boot/30.md index b6136e92cce29d2766641bea6bec9c12052b8c14..d20b83b42f8ea2f48b14597bf03b103c88584058 100644 --- a/docs/spring-boot/30.md +++ b/docs/spring-boot/30.md @@ -292,4 +292,4 @@ $ curl localhost:8080 ``` -在本教程中,我们使用 Thymeleaf 创建了 Spring Boot Web 应用。 您可能也对相关教程感兴趣: [Spring Boot Thymeleaf 教程](/articles/springbootthymeleaf/), [Spring Boot 自动控制器](/articles/springbootautocontroller/), [Spring Boot FreeMarker 教程](/springboot/freemarker/), [Spring Boot Swing 集成 教程](/articles/springbootswing/), [Spring Web 应用简介](/articles/springwebfirst/),[独立的 Spring 应用](/articles/standalonespring/), [FreeMarker 教程](/java/freemarker/)或 [Java 教程](/lang/java/)。 \ No newline at end of file +在本教程中,我们使用 Thymeleaf 创建了 Spring Boot Web 应用。 您可能也对相关教程感兴趣: [Spring Boot Thymeleaf 教程](/articles/springbootthymeleaf/), [Spring Boot 自动控制器](/articles/springbootautocontroller/), [Spring Boot FreeMarker 教程](/springboot/freemarker/), [Spring Boot Swing 集成教程](/articles/springbootswing/), [Spring Web 应用简介](/articles/springwebfirst/),[独立的 Spring 应用](/articles/standalonespring/), [FreeMarker 教程](/java/freemarker/)或 [Java 教程](/lang/java/)。 \ No newline at end of file diff --git a/docs/spring-boot/31.md b/docs/spring-boot/31.md index c2424ea15c4e0a52c2358cbc9ac0090d6c35abfa..fd598d4311cdc7c5907aa2f2e6d259aae5eddcc6 100644 --- a/docs/spring-boot/31.md +++ b/docs/spring-boot/31.md @@ -2,7 +2,7 @@ > [http://zetcode.com/articles/springbootautocontroller/](http://zetcode.com/articles/springbootautocontroller/) -Spring Boot 自动化控制器展示了如何使用 ViewControllerRegistry 在 Spring Boot 应用中创建简单的自动化控制器。 我们的应用显示一个显示当前日期的简单页面。 我们使用 FreeMarker 作为模板引擎。 +Spring Boot 自动化控制器展示了如何使用`ViewControllerRegistry`在 Spring Boot 应用中创建简单的自动化控制器。 我们的应用显示一个显示当前日期的简单页面。 我们使用 FreeMarker 作为模板引擎。 Spring 是流行的 Java 应用框架。 Spring Boot 致力于创建独立的,基于生产级别的基于 Spring 的应用,而无任何麻烦。 diff --git a/docs/spring-boot/33.md b/docs/spring-boot/33.md index cf26f33bc87202427cdf454d5b5057f9f8790f46..f61a3b1bb54e020e9c96b27032425eaaa14abab7 100644 --- a/docs/spring-boot/33.md +++ b/docs/spring-boot/33.md @@ -2,7 +2,7 @@ > 原文: [http://zetcode.com/articles/springbootenvironment/](http://zetcode.com/articles/springbootenvironment/) -Spring Boot Environment 显示了如何在 Spring Boot 中读取环境变量。 Spring Boot 应用可以部署在各种环境中,在这种情况下读取环境变量可能会有所帮助。 +Spring Boot `Environment`显示了如何在 Spring Boot 中读取环境变量。 Spring Boot 应用可以部署在各种环境中,在这种情况下读取环境变量可能会有所帮助。 Spring 是一种流行的 Java 应用框架,而 Spring Boot 是 Spring 的下一步发展,它可以帮助您以最少的精力创建独立的,生产级的基于 Spring 的应用。 @@ -96,7 +96,7 @@ app.name=MyApp ``` -`application.properties`文件包含应用配置设置。 Spring 具有一些内置的应用属性,我们可以创建自定义属性。 `spring.main.banner-mode`属性是 Spring 内置属性; 我们关闭了春天的旗帜。 接下来的两行设置了带有颜色支持的日志记录。 `app.name`是我们的自定义属性,其中包含应用名称。 +`application.properties`文件包含应用配置设置。 Spring 具有一些内置的应用属性,我们可以创建自定义属性。 `spring.main.banner-mode`属性是 Spring 内置属性; 我们关闭了Spring的标志。 接下来的两行设置了带有颜色支持的日志记录。 `app.name`是我们的自定义属性,其中包含应用名称。 `resources/logback.xml` @@ -189,4 +189,4 @@ $ mvn -q spring-boot:run 我们运行该应用。 `-q` Maven 选项关闭 Maven 消息。 -在本教程中,我们使用 Spring `Environment`来读取环境变量。 您可能也对相关教程感兴趣: [SpringApplicationBuilder 教程](/springboot/springapplicationbuilder/),[在 Spring Boot 中提供静态内容](/springboot/static/), [Spring Boot DataSourceBuilder 教程](/springboot/datasourcebuilder/), [Java 教程](/lang/java/)或列出[所有 Spring Boot 教程](/all/#springboot)。 \ No newline at end of file +在本教程中,我们使用 Spring `Environment`来读取环境变量。 您可能也对相关教程感兴趣: [`SpringApplicationBuilder`教程](/springboot/springapplicationbuilder/),[在 Spring Boot 中提供静态内容](/springboot/static/), [Spring Boot `DataSourceBuilder`教程](/springboot/datasourcebuilder/), [Java 教程](/lang/java/)或列出[所有 Spring Boot 教程](/all/#springboot)。 \ No newline at end of file diff --git a/docs/spring-boot/35.md b/docs/spring-boot/35.md index 6f3bd86d88044ab716f4f5f5ee9943f2fafccbc4..d1d0068d4892bdbe48847979e20427206082932e 100644 --- a/docs/spring-boot/35.md +++ b/docs/spring-boot/35.md @@ -211,4 +211,4 @@ $ mvn spring-boot:run -q 我们运行该应用。 `-q` Maven 选项关闭 Maven 消息。 -在本教程中,我们使用 Spring Boot 框架创建了一个 Swing 应用。 您可能也对相关教程感兴趣: [Java Swing 教程](/tutorials/javaswingtutorial/),[独立的 Spring 应用](/articles/standalonespring/), [Java 教程](/lang/java/)或列出[所有 Spring Boot 教程](/all/#sprigboot) ]。 \ No newline at end of file +在本教程中,我们使用 Spring Boot 框架创建了一个 Swing 应用。 您可能也对相关教程感兴趣: [Java Swing 教程](/tutorials/javaswingtutorial/),[独立的 Spring 应用](/articles/standalonespring/), [Java 教程](/lang/java/)或列出[所有 Spring Boot 教程](/all/#sprigboot)。 \ No newline at end of file diff --git a/docs/spring-boot/36.md b/docs/spring-boot/36.md index 3cbb2ec57113153bcfc66764d273865967b8d4dd..bc27bc4e5c1558e8d51ba8886eb5877315a8bccf 100644 --- a/docs/spring-boot/36.md +++ b/docs/spring-boot/36.md @@ -145,7 +145,7 @@ var imgFile = new ClassPathResource("image/sid.jpg"); ``` -我们从类路径与`ClassPathResource`图片资源中(src /主/资源目录是在 Java 类路径)。 +我们从类路径与`ClassPathResource`图片资源中(`src/main/resource`是在 Java 类路径)。 ```java response.setContentType(MediaType.IMAGE_JPEG_VALUE); diff --git a/docs/spring-boot/37.md b/docs/spring-boot/37.md index ccd725c6a8045ec7f1b8387f4a7effb5d8c0cc96..9f1a795defa07268a8ac5063cd2bf38ef2b7c642 100644 --- a/docs/spring-boot/37.md +++ b/docs/spring-boot/37.md @@ -2,7 +2,7 @@ > 原文: [http://zetcode.com/springboot/servepdf/](http://zetcode.com/springboot/servepdf/) -Spring Boot Serve PDF 报告教程展示了如何在 Spring Boot Web 应用中提供 PDF 文件。 该报告是使用 iText 库生成的。 +Spring Boot 创建 PDF 报告教程展示了如何在 Spring Boot Web 应用中提供 PDF 文件。 该报告是使用 iText 库生成的。 iText 是一个开放源代码库,用于在 Java 中创建和处理 PDF 文件。 @@ -253,7 +253,7 @@ logging: ``` -`application.yml`是主要的 Spring Boot 配置文件。 使用`banner-mode`属性,我们可以关闭 Spring 标语。 Spring 框架日志记录设置为 ERROR。 +`application.yml`是主要的 Spring Boot 配置文件。 使用`banner-mode`属性,我们可以关闭 Spring 标语。 Spring 框架日志记录设置为`ERROR`。 `resources/import.sql` diff --git a/docs/spring-boot/38.md b/docs/spring-boot/38.md index 3a62b9c849d78e5957e96ccb153e49aff27844c4..0320aa3a541b92dc00dbc50ad6b6fbc3f0e60c24 100644 --- a/docs/spring-boot/38.md +++ b/docs/spring-boot/38.md @@ -2,7 +2,7 @@ > 原文: [http://zetcode.com/springboot/annotations/](http://zetcode.com/springboot/annotations/) -Spring Boot 基本注解教程展示了如何使用基本的 Spring Boot 注解,包括@ Bean,@ Service,@ Configuration,@ Controller,@ RequestMapping,@ Repository,@ Autowired 和@SpringBootApplication。 +Spring Boot 基本注解教程展示了如何使用基本的 Spring Boot 注解,包括`@Bean`,`@Service`,`@Configuration`,`@Controller`,`@RequestMapping`,`@Repository`,`@Autowired`和`@SpringBootApplication`。 Spring 是用于创建企业应用的流行 Java 应用框架。 Spring Boot 是 Spring 框架发展的下一步。 它有助于以最小的努力创建独立的,基于生产级的 Spring 应用。 它不再使用 XML 配置,并实现了约定而非配置原则。 @@ -12,14 +12,14 @@ Spring 是用于创建企业应用的流行 Java 应用框架。 Spring Boot 是 在示例应用中,我们具有以下 Spring Boot 注解: -* @Bean-表示方法产生一个由 Spring 管理的 bean。 -* @Service-表示带注解的类是服务类。 -* @Repository-指示带注解的类是存储库,它是数据访问和存储的抽象。 -* @Configuration-表示一个类是可能包含 bean 定义的配置类。 -* @Controller-将类标记为 Web 控制器,能够处理请求。 -* @RequestMapping-将 HTTP 请求及其路径映射到控制器方法。 -* @Autowired-标记要通过 Spring 依赖注入自动装配的构造函数,字段或 setter 方法。 -* @SpringBootApplication-启用 Spring Boot 自动配置和组件扫描。 +* `@Bean` - 表示方法产生一个由 Spring 管理的 bean。 +* `@Service` - 表示带注解的类是服务类。 +* `@Repository` - 指示带注解的类是存储库,它是数据访问和存储的抽象。 +* `@Configuration` - 表示一个类是可能包含 bean 定义的配置类。 +* `@Controller` - 将类标记为 Web 控制器,能够处理请求。 +* `@RequestMapping` - 将 HTTP 请求及其路径映射到控制器方法。 +* `@Autowired` - 标记要通过 Spring 依赖注入自动装配的构造函数,字段或设置方法。 +* `@SpringBootApplication` - 启用 Spring Boot 自动配置和组件扫描。 `@Component`是 Spring 托管组件的通用构造型。 在自动扫描时,它将类转换为 Spring bean。 当使用基于注解的配置和类路径扫描时,被此注解修饰的类被视为自动检测的候选对象。 `@Repository`,`@Service`和`@Controller`是`@Component`的特殊化,用于更特定的用例。 diff --git a/docs/spring-boot/39.md b/docs/spring-boot/39.md index feda363bbae6f0c6c09627266fda3337f17c9e82..49e57ed962d999f928671af5ffc39eb8b8034413 100644 --- a/docs/spring-boot/39.md +++ b/docs/spring-boot/39.md @@ -2,7 +2,7 @@ > 原文: [http://zetcode.com/springboot/responsebody/](http://zetcode.com/springboot/responsebody/) -在 Spring Boot @ResponseBody 教程中,我们将在控制器中使用 Spring `@ResponseBody`注解将数据写入响应对象的主体。 +在 Spring Boot `@ResponseBody`教程中,我们将在控制器中使用 Spring `@ResponseBody`注解将数据写入响应对象的主体。 Spring 是流行的 Java 应用框架,而 Spring Boot 是 Spring 的演进,可以帮助轻松地创建独立的,生产级的基于 Spring 的应用。 @@ -12,7 +12,7 @@ JQuery 是一个流行的开源 JavaScript 库,旨在简化 HTML 的客户端 ## Spring `@ResponseBody` -@ResponseBody 是一个 Spring 注解,它将方法返回值绑定到 Web 响应主体。 它不解释为视图名称。 它使用 HTTP 消息转换器根据请求 HTTP 标头中的内容类型将返回值转换为 HTTP 响应主体。 +`@ResponseBody`是一个 Spring 注解,它将方法返回值绑定到 Web 响应主体。 它不解释为视图名称。 它使用 HTTP 消息转换器根据请求 HTTP 标头中的内容类型将返回值转换为 HTTP 响应主体。 ## Spring `@ResponseBody`示例 @@ -308,7 +308,7 @@ public List findCities() { ``` -对于`GetCities`路径,将调用`findCities()`方法。 `produces`参数指示该方法返回 JSON 数据; Spring `RequestResponseBodyMethodProcessor`通过使用`HttpMessageConverter`写入响应主体来处理用`@ResponseBody`注解的方法的返回值。 在我们的例子中,消息转换器是`MappingJackson2HttpMessageConverter`,它使用杰克逊的 ObjectMapper 读取和写入 JSON。 (杰克逊是一个流行的 Java JSON 库。) +对于`GetCities`路径,将调用`findCities()`方法。 `produces`参数指示该方法返回 JSON 数据; Spring `RequestResponseBodyMethodProcessor`通过使用`HttpMessageConverter`写入响应主体来处理用`@ResponseBody`注解的方法的返回值。 在我们的例子中,消息转换器是`MappingJackson2HttpMessageConverter`,它使用Jackson的`ObjectMapper`读取和写入 JSON。 (Jackson是一个流行的 Java JSON 库。) `resources/templates/index.ftl` @@ -377,4 +377,4 @@ public List findCities() { 通过`$.getJSON()`方法,我们使用 HTTP GET 请求以 JSON 格式加载数据。 数据用`$.each()`遍历并写入 HTML 列表。 -在本教程中,我们在 Spring Boot Web 应用中使用了`@ResponseBody`注解。 您可能也对相关教程感兴趣: [Spring Boot ResponseEntity 教程](/springboot/responseentity/), [Spring Boot @PathVariable 教程](/springboot/pathvariable/), [Spring Boot 上传文件](/springboot/uploadfile/), [Spring Boot @ RequestParam 教程](/springboot/requestparam/),[独立的 Spring 应用](/articles/standalonespring/), [Java 教程](/lang/java/)或列出[所有 Spring Boot 教程](/all/#springboot)。 \ No newline at end of file +在本教程中,我们在 Spring Boot Web 应用中使用了`@ResponseBody`注解。 您可能也对相关教程感兴趣: [Spring Boot `ResponseEntity`教程](/springboot/responseentity/), [Spring Boot `@PathVariable`教程](/springboot/pathvariable/), [Spring Boot 上传文件](/springboot/uploadfile/), [Spring Boot `@RequestParam`教程](/springboot/requestparam/),[独立的 Spring 应用](/articles/standalonespring/), [Java 教程](/lang/java/)或列出[所有 Spring Boot 教程](/all/#springboot)。 \ No newline at end of file diff --git a/docs/spring-boot/44.md b/docs/spring-boot/44.md index fae7b3b6848b858846bcf5692157755b70b327d9..8f35fd560264e87b0f50f499d0d19ded78560122 100644 --- a/docs/spring-boot/44.md +++ b/docs/spring-boot/44.md @@ -108,7 +108,7 @@ app.name=SpringBootBean ``` -`application.properties`文件包含应用配置设置。 有一些内置的应用属性,我们可以创建自定义属性。 `spring.main.banner-mode`属性是 Spring 内置属性; 我们关闭了春天的旗帜。 `app.name`是我们的自定义属性,其中包含应用名称。 +`application.properties`文件包含应用配置设置。 有一些内置的应用属性,我们可以创建自定义属性。 `spring.main.banner-mode`属性是 Spring 内置属性; 我们关闭了Spring的标志。 `app.name`是我们的自定义属性,其中包含应用名称。 `resources/logback.xml` diff --git a/docs/spring-boot/75.md b/docs/spring-boot/75.md index d81011a5daff01e35f3e78075143e3be19e7d9a5..1c1ce4f31ad6ff50d84b69eef1dc9bfbab876ebf 100644 --- a/docs/spring-boot/75.md +++ b/docs/spring-boot/75.md @@ -106,7 +106,7 @@ logging.pattern.console=%clr(%d{yy-MM-dd E HH:mm:ss.SSS}){blue} %clr(%-5p) %clr( ``` -在`application.properties`文件中,我们有一个春天启动应用的各种配置设置。 使用`spring.main.banner-mode`属性,我们可以关闭 Spring 标语。 `logging.pattern.console`配置控制台日志记录模式。 +在`application.properties`文件中,我们有一个Spring启动应用的各种配置设置。 使用`spring.main.banner-mode`属性,我们可以关闭 Spring 标语。 `logging.pattern.console`配置控制台日志记录模式。 `com/zetcode/controller/MyController.java`