Spring1


layout: post
title: spring
subtitle: 搭建、配置、属性注入
date: 2018-06-04
author: ZL
header-img: img/20180604.jpg
catalog: true
tags:
- spring
- 属性注入


介绍

三层架构中spring位置

image

spring一站式框架

  • 正是因为spring框架性质是属于容器性质的.
  • 容器中装什么对象就有什么功能.所以可以一站式.
  • 不仅不排斥其他框架,还能帮其他框架管理对象.
  • aop支持
  • ioc思想
  • spring jdbc
  • aop 事务
  • junit 测试支持

例子搭建

导包

基础包

image

日志包

image

可选日志包(老版本需要,新版本不需要)

image

创建一个对象

public class User {
    private String name;
    private String age;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
}

配置文件applicationContext.xml(需要在src目录下,命名可以随意)

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://www.springframework.org/schema/beans" 
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd ">

  <!-- 将User对象交给spring容器管理 -->
  <!-- Bean元素:使用该元素描述需要spring容器管理的对象
    class属性:被管理对象的完整类名.
    name属性:给被管理的对象起个名字.获得对象时根据该名称获得对象.  
        可以重复.可以使用特殊字符.
    id属性: 与name属性一模一样. 
        名称不可重复.不能使用特殊字符.
    结论: 尽量使用name属性.
  -->
    <bean name="user" class = "zl.bean.User"></bean>
</beans>

代码测试

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import zl.bean.User;

public class Demo {
    @Test
    public void test() {
        //1.创建容器对象
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        //2.向容器要User对象
        User u = (User) ac.getBean("user");
        //3.打印user对象
        System.out.println(u);
    }
}

打印结果

zl.bean.User@670b40af

spring理论

IOC:就是对象的创建不需要new了,而是从spring中去取。

image

DI:就是说A对象里面用到了B对象,会把B对象注入到A对象里面

image

applicationContext&BeanFactory(了解)

applicationContext和BeanFactory功能差不多,在以前电脑配置差的时候使用BeanFactory,现在都用applicationContext了。主要区别就是对内存的需求大小不一样,

BeanFactory接口实现类的容器.特点是每次在获得对象时才会创建对象
applicationContext每次容器启动时就会创建容器中配置的所有对象.并提供更多功能

applicationContext使用:

    public void test() {
        //1.创建容器对象
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        //2.向容器要User对象
        User u = (User) ac.getBean("user");
        //3.打印user对象
        System.out.println(u);
    }

BeanFactory使用:

    public void test() {
        XmlBeanFactory factory = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
        User u = (User) factory .getBean("user");
        System.out.println(u);
    }

applicationContext加载配置文件

丛类路径下加载配置文件:ClassPathXmlApplicationContext
从硬盘绝对路径下加载配置文件:FileSystemXmlApplicationContext("d:/xxx/yyy/xxx")

配置详解

bean

<!-- 将User对象交给spring容器管理 -->
<!-- Bean元素:使用该元素描述需要spring容器管理的对象
  class属性:被管理对象的完整类名.
  name属性:给被管理的对象起个名字.获得对象时根据该名称获得对象.  
      可以重复.可以使用特殊字符.
  id属性: 与name属性一模一样. 
      名称不可重复.不能使用特殊字符.
  结论: 尽量使用name属性.
-->
<bean name="user" class = "zl.bean.User"></bean>

scope属性

位置在applicationContext.xml:

<bean name="user1" class = "zl.bean.User" scope=""></bean>

取值:

  • singleton(默认值):单例对象.被标识为单例的对象在spring容器中只会存在一个实例
public void fun4(){
  ApplicationContext ac = new ClassPathXmlApplicationContext("cn/itcast/b_create/applicationContext.xml");
  User u = (User) ac.getBean("user");
  User u2 = (User) ac.getBean("user");
  User u3 = (User) ac.getBean("user");
  User u4 = (User) ac.getBean("user");
  System.out.println(u2==u4);//单例:true
}
  • prototype:多例原型.被标识为多例的对象,每次在获取对象时才会创建.每次创建都是新的对象.整合struts2时,ActionBean必须配置为多例的.
public void fun4(){
  ApplicationContext ac = new ClassPathXmlApplicationContext("cn/itcast/b_create/applicationContext.xml");
  User u = (User) ac.getBean("user");
  User u2 = (User) ac.getBean("user");
  User u3 = (User) ac.getBean("user");
  User u4 = (User) ac.getBean("user");
  System.out.println(u2==u4);//多例:false
}
  • request:web环境下.对象与request生命周期一致.(没用)
  • session:web环境下,对象与session生命周期一致.(没用)

lazy-init="true"

延迟加载,启动时不实例化,而是第一次被请求时才创建实例。不设置的话,默认false,启动时就创建实例。
ps:当lazy-init="false",而scope的值是prototype时,依然是获取对象时才会被实例化。

   <!-- A bean definition with lazy init set on -->
   <bean id="..." class="..." lazy-init="true">
       <!-- collaborators and configuration for this bean go here -->
   </bean>

生命周期属性

配置位置在applicationContext.xml:

<bean  
name="user" class="cn.itcast.bean.User" init-method="init" destroy-method="destory" >
</bean>
  • init-method:配置一个方法作为生命周期初始化方法.spring会在对象创建之后立即调用.
  • destory-method:配置一个方法作为生命周期的销毁方法.spring容器在关闭并销毁所有容器中的对象之前调用.

方法所在位置:

public class User {
    public User() {
            System.out.println("User对象空参构造方法!!!!");
    }
    private String name;
    private Integer age;
    private Car car;
    public User(String name, Car car) {
        System.out.println("User(String name, Car car)!!");
        this.name = name;
        this.car = car;
    }
    public User(Car car,String name) {
        System.out.println("User(Car car,String name)!!");
        this.name = name;
        this.car = car;
    }
    public User(Integer name, Car car) {
        System.out.println("User(Integer name, Car car)!!");
        this.name = name+"";
        this.car = car;
    }
    public Car getCar() {
        return car;
    }
    public void setCar(Car car) {
        this.car = car;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
  //============================
    public void init(){
        System.out.println("我是初始化方法!");
    }
    public void destory(){
        System.out.println("我是销毁方法!");
    }
  //=============================
  
    @Override
    public String toString() {
        return "User [name=" + name + ", age=" + age + ", car=" + car + "]";
    }
}

ps:还可以配置全局的init和destory:

Spring Bean后置处理器(2018.8.10添加关于后置处理器的内容)

在bean被实例化的前后分别有两个回调方法,有需要的话可以在这两个方法中作其他逻辑处理。

bean类:

package com.tutorialspoint;
public class HelloWorld {
  private String message;
  public void setMessage(String message){
     this.message  = message;
  }
  public void getMessage(){
     System.out.println("Your Message : " + message);
  }
  public void init(){
     System.out.println("Bean is going through init.");
  }
  public void destroy(){
     System.out.println("Bean will destroy now.");
  }
}

后置处理器类

import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.beans.BeansException;
public class InitHelloWorld implements BeanPostProcessor {
   public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
      System.out.println("BeforeInitialization : " + beanName);
      return bean;  // you can return any other object as well
   }
   public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
      System.out.println("AfterInitialization : " + beanName);
      return bean;  // you can return any other object as well
   }
}

applicationContext.xml配置文件

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

   <bean id="helloWorld" class="com.tutorialspoint.HelloWorld"
       init-method="init" destroy-method="destroy">
       <property name="message" value="Hello World!"/>
   </bean>

   <bean class="com.tutorialspoint.InitHelloWorld" />

</beans>

调用

package com.tutorialspoint;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class MainApp {
   public static void main(String[] args) {
      AbstractApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
      HelloWorld obj = (HelloWorld) context.getBean("helloWorld");
      obj.getMessage();
      context.registerShutdownHook();
   }
}

运行结果:

BeforeInitialization : helloWorld(后置处理器的before方法)
Bean is going through init.(bean的init方法被调用)
AfterInitialization : helloWorld(后置处理器的after方法)
Your Message : Hello World!
Bean will destroy now.(bean的destroy方法被调用)

1.可以看到后置处理器的两个方法运行的位置是在bean类的init方法的前后
2.后置处理器的配置<bean class="com.tutorialspoint.InitHelloWorld" />,就像普通bean类一样在xml文件中申明就可以了
3.后置处理器申明了以后是没有和某个bean类绑定的,它是对所有的bean类都起作用的
4.另外,是可以配置多个后置处理器的,并且这多个后置处理器都可以起作用,还可以指定后置处理器的调用顺序,需要实现接口Ordered,这个这里不详细说明,可以自行查阅其他资料

Spring Bean定义继承(2019.8.10添加关于bean定义继承的内容)

这个作用不大,而且也是一看就懂系列,其他代码内容就不放了,直接放xml中bean的代码

  • 方式一:
<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

   <bean id="helloWorld" class="com.tutorialspoint.HelloWorld">
      <property name="message1" value="Hello World!"/>
      <property name="message2" value="Hello Second World!"/>
   </bean>

    <!--parent="helloWorld"指明helloworld是它的父亲-->
   <bean id="helloIndia" class="com.tutorialspoint.HelloIndia" parent="helloWorld">
      <property name="message1" value="Hello India!"/>
      <property name="message3" value="Namaste India!"/>
   </bean>

</beans>

方式二:专门搞一个bean的模板,父bean是abstract,不能被实例化,只是给其他bean作父亲用的

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

   <bean id="beanTeamplate" abstract="true">
      <property name="message1" value="Hello World!"/>
      <property name="message2" value="Hello Second World!"/>
      <property name="message3" value="Namaste India!"/>
   </bean>

   <bean id="helloIndia" class="com.tutorialspoint.HelloIndia" parent="beanTeamplate">
      <property name="message1" value="Hello India!"/>
      <property name="message3" value="Namaste India!"/>
   </bean>

</beans>

spring创建Bean对象方式

方式一:空参构造方式(最常用)

applicationContext.xml:

<bean name="user1" class = "zl.bean.User"></bean>

java调用:

@Test
public void test() {
  ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
  
  User u = (User) ac.getBean("user1");
  System.out.println(u);
}

方式二:静态工厂创建(了解)

applicationContext.xml:

<bean name="user2" class="zl.factory.UserFactory" factory-method="createUser"></bean>

UserFactory:

public class UserFactory {
  //注意是static
    public static User createUser() {
        System.out.println("静态工厂创建User");
        return new User();
    }
}

java调用:

@Test
public void test() {
  ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");

  User u2 = (User) ac.getBean("user2");
  System.out.println(u2);
}

方式三:实例工厂创建(了解)

applicationContext.xml:

<bean name="user3" factory-bean="userFactory" factory-method="createUser2"></bean>
<bean name="userFactory" class="zl.factory.UserFactory"></bean>

UserFactory:

public class UserFactory {
  //注意不是static
    public User createUser2() {
        System.out.println("实例工厂创建User");
        return new User();
    }
}

java调用:

@Test
public void test() {
  ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");

  User u3 = (User) ac.getBean("user3");
  System.out.println(u3);
}

spring分模块配置

public class User {
    public User() {
            System.out.println("User对象空参构造方法!!!!");
    }
    private String name;
    private Integer age;
    private Car car;
  
    public User(String name, Car car) {
        System.out.println("User(String name, Car car)!!");
        this.name = name;
        this.car = car;
    }
    public User(Car car,String name) {
        System.out.println("User(Car car,String name)!!");
        this.name = name;
        this.car = car;
    }
    public User(Integer name, Car car) {
        System.out.println("User(Integer name, Car car)!!");
        this.name = name+"";
        this.car = car;
    }
    public Car getCar() {
        return car;
    }
    public void setCar(Car car) {
        this.car = car;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
    public void init(){
        System.out.println("我是初始化方法!");
    }
    public void destory(){
        System.out.println("我是销毁方法!");
    }
    @Override
    public String toString() {
        return "User [name=" + name + ", age=" + age + ", car=" + car + "]";
    }
}

Car

package zl.bean;

public class Car {
    private String  name;
    private String color;
    
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getColor() {
        return color;
    }
    public void setColor(String color) {
        this.color = color;
    }
    @Override
    public String toString() {
        return "Car [name=" + name + ", color=" + color + "]";
    }
}

set注入

配置

<bean name="user1" class = "zl.bean.User">
  <!-- 值类型的set注入 -->
  <property name="name" value = "tom"></property>
  <property name="age" value = "18"></property>
  <!-- 引用类型的set注入 -->
  <property name="car" ref = "car"></property>
</bean>

<!-- 想要引用类型的set注入,必须先申明引用类型 -->
<bean name="car" class="zl.bean.Car">
  <property name="name" value="兰博基尼" ></property>
  <property name="color" value="黄色" ></property>
</bean>

调用

@Test
public void fun1() {
  ApplicationContext applicationContext = new ClassPathXmlApplicationContext("zl/injection/applicationContext.xml");
  User user = (User) applicationContext.getBean("user1");
  System.out.println(user);
}

运行结果

User [name=tom, age=18, car=Car [name=兰博基尼, color=黄色]]

构造函数注入

配置

<!-- name属性: 构造函数的参数名 -->
<!-- index属性: 构造函数的参数索引(第几个参数)(可以不写) -->
<!-- type属性: 构造函数的参数类型(可以不写)-->
<bean name="user2" class="zl.bean.User">
  <constructor-arg name="name" index="0" type="java.lang.String" value="999"></constructor-arg>
  <constructor-arg name="car" ref="car" index="1"></constructor-arg>
</bean>

<!-- 想要引用类型的set注入,必须先申明引用类型 -->
<bean name="car" class="zl.bean.Car">
  <property name="name" value="兰博基尼" ></property>
  <property name="color" value="黄色" ></property>
</bean>

调用

@Test
public void fun2() {
  ApplicationContext applicationContext = new ClassPathXmlApplicationContext("zl/injection/applicationContext.xml");
  User user = (User) applicationContext.getBean("user2");
  System.out.println(user);
}

运行结果

User对象空参构造方法!!!!
User(Integer name, Car car)!!
User [name=999, age=null, car=Car [name=兰博基尼, color=黄色]]

p名称控件注入(不掌握)

配置

<!--必须加上这个约束-->
xmlns:p="http://www.springframework.org/schema/p" 

<bean name="user3" class="zl.bean.User" p:name = "tom" p:age = "29" p:car-ref="car"></bean>

<!-- 想要引用类型的set注入,必须先申明引用类型 -->
<bean name="car" class="zl.bean.Car">
  <property name="name" value="兰博基尼" ></property>
  <property name="color" value="黄色" ></property>
</bean>

调用

@Test
public void fun3() {
  ApplicationContext applicationContext = new ClassPathXmlApplicationContext("zl/injection/applicationContext.xml");
  User user = (User) applicationContext.getBean("user3");
  System.out.println(user);
}

运行结果

User对象空参构造方法!!!!
User(String name, Car car)!!
User对象空参构造方法!!!!
User [name=tom, age=29, car=Car [name=兰博基尼, color=黄色]]

spel注入(spring Expression Language sping表达式语言)(不掌握)

配置

<!--需要配置好其他的user1、user4、car等-->
<bean name="user4" class = "zl.bean.User">
  <property name="name" value = "#{user1.name}"></property>
  <property name="age" value = "#{user3.age}"></property>
  <property name="car" ref = "car"></property>
</bean>

调用

@Test
public void fun4() {
  ApplicationContext applicationContext = new ClassPathXmlApplicationContext("zl/injection/applicationContext.xml");
  User user = (User) applicationContext.getBean("user4");
  System.out.println(user);
}

运行结果

User对象空参构造方法!!!!
User(String name, Car car)!!
User对象空参构造方法!!!!
User对象空参构造方法!!!!
User [name=user的nametom, age=29, car=Car [name=兰博基尼, color=黄色]]

spring复杂类型属性注入

bean类准备

package zl.injection;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;

public class CollectionBean {
    private Object[] arr;//数组类型注入
    private List list;//list/set 类型注入
    private Map map;//map类型注入
    private Properties prop;//properties类型注入
    
    public Object[] getArr() {
        return arr;
    }
    public void setArr(Object[] arr) {
        this.arr = arr;
    }
    public List getList() {
        return list;
    }
    public void setList(List list) {
        this.list = list;
    }
    public Map getMap() {
        return map;
    }
    public void setMap(Map map) {
        this.map = map;
    }
    public Properties getProp() {
        return prop;
    }
    public void setProp(Properties prop) {
        this.prop = prop;
    }
    @Override
    public String toString() {
        return "CollectionBean [arr=" + Arrays.toString(arr) + ", list=" + list + ", map=" + map + ", prop=" + prop
                + "]";
    }
}

配置

<bean name="cb" class="zl.injection.CollectionBean">
  <property name="arr">
    <array>
      <value>tom</value>
      <value>jack</value>
      <!--往数组里面存对象类型-->
      <ref bean="user4"/>
    </array>
  </property>
  
  <property name="list"  >
    <list>
      <value>jack</value>
      <value>rose</value>
      <ref bean="user3" />
    </list>
  </property>
  
  <property name="map"  >
    <map>
      <entry key="url" value="jdbc:mysql:///crm" ></entry>
      <entry key="user" value-ref="user4"  ></entry>
      <entry key-ref="user3" value-ref="user2"  ></entry>
    </map> 
  </property>
  
  <property name="prop"  >
    <props>
      <prop key="driverClass">com.jdbc.mysql.Driver</prop>
      <prop key="userName">root</prop>
      <prop key="password">1234</prop>
    </props>
  </property>
</bean>

调用

@Test
public void fun5() {
  ApplicationContext applicationContext = new ClassPathXmlApplicationContext("zl/injection/applicationContext.xml");
  CollectionBean cb = (CollectionBean) applicationContext.getBean("cb");
  System.out.println(cb);
}

结果

CollectionBean [arr=[tom, jack, User [name=user的nametom, age=29, car=Car [name=兰博基尼, color=黄色]]], list=[jack, rose, User [name=tom, age=29, car=Car [name=兰博基尼, color=黄色]]], map={url=jdbc:mysql:///crm, user=User [name=user的nametom, age=29, car=Car [name=兰博基尼, color=黄色]], User [name=tom, age=29, car=Car [name=兰博基尼, color=黄色]]=User [name=999, age=null, car=Car [name=兰博基尼, color=黄色]]}, prop={driverClass=com.jdbc.mysql.Driver, password=1234, userName=root}]

注入空值或者null(2018.8.10添加注入控制和null)

注入空值:
<bean id="..." class="exampleBean">
   <property name="email" value=""/>
</bean>
--------------------------------------
注入null:
<bean id="..." class="exampleBean">
   <property name="email"><null/></property>
</bean>
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 220,192评论 6 511
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,858评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,517评论 0 357
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,148评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,162评论 6 397
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,905评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,537评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,439评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,956评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,083评论 3 340
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,218评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,899评论 5 347
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,565评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,093评论 0 23
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,201评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,539评论 3 375
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,215评论 2 358

推荐阅读更多精彩内容

  • 1.1 Spring IoC容器和bean简介 本章介绍了Spring Framework实现的控制反转(IoC)...
    起名真是难阅读 2,584评论 0 8
  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,675评论 18 139
  • 1.1 spring IoC容器和beans的简介 Spring 框架的最核心基础的功能是IoC(控制反转)容器,...
    simoscode阅读 6,721评论 2 22
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,833评论 6 342
  • 关于成功,这大概是近十几年每个中国人最关心的话题。 谈到成功,顺便提下流行二十几年的成功学,有位前辈说:近三十年中...
    河洛一剑阅读 1,972评论 0 0