• spring in action 01


    环境搭建

    可以通过 eclipse -> help 菜单 -> Eclipse Marketplace, 然后选择 popular, 从中找到 Spring Tool Suite(STS)插件.

    这样就安装了 STS 插件, 可以方便引入 Spring Boot 的 starter, 而 starter 会引入对应的依赖包和服务器, 这样快速帮我们搭建环境.

    spring boot 可以不在使用 war 包来部署应用了.

    A new interest in reactive programming aims to provide greater scalability and improved proformance with non-blocking operations.

    传统方式

    当有这两个 service, (inventory service 和 product service), 传统方式是: xml 或 java bean

    <bean id="inventoryService"
    class="com.example.InventoryService" />
    <bean id="productService"
    class="com.example.ProductService" />
    <constructor-arg ref="inventoryService" />
    </bean>
    @Configuration
    public class ServiceConfiguration {
    @Bean
    public InventoryService inventoryService() {
    return new InventoryService();
    }
    @Bean
    public ProductService productService() {
    return new ProductService(inventoryService());
    }
    }

    The @Configuration annotation indicates to Spring that this is a configuration class that will provide beans to the Spring application context.

     Automatic configuration has its roots in the Spring techniques known as autowiring and component scanning. 

    component scanning: Spring can automatically discover components from an application's classpath and create them as beans.

    autowiring: Spring automatically injects the components with the other beans that they depend on.

    More recently, with introduction of Spring Boot, automatic configuration has gone well beyond component scanning and autowiring.

    Spring Boot, the most well-know, is autoconfiguration. (所以spring boot 就更近一步, 不用设置了)

  • 相关阅读:
    R学习笔记3 数据处理
    R学习笔记2 因子
    R学习笔记1 介绍R的使用
    正则表达式之邮箱、手机号码、电话号码,url地址
    vue之axios运用
    angularJS导出数据到Excel
    vue2全选反选
    css设置垂直居中
    js实现鼠标选中文本改变选中区域颜色以及给选中区域加上html标签
    安装了Vetur之后的配置
  • 原文地址:https://www.cnblogs.com/moveofgod/p/12643891.html
Copyright © 2020-2023  润新知