zoukankan      html  css  js  c++  java
  • 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 就更近一步, 不用设置了)

  • 相关阅读:
    动态规划
    关键路径
    拓扑排序
    最小生成树
    Floyd 多源最短路径
    SPFA算法
    Bellman_Ford算法(负环的单源路径)
    Dijkstra算法
    fill和memset的区别
    Codeforces Round #655 (Div. 2) 题解
  • 原文地址:https://www.cnblogs.com/moveofgod/p/12643891.html
Copyright © 2011-2022 走看看