Spring框架的IOC捕虽、DI慨丐、AOP應(yīng)用詳解

什么是Spring

是一個為簡化企業(yè)級應(yīng)用開發(fā)的開源框架,作為IOC(DI)泄私、AOP容器咖气。


特性

輕量級:占用空間小挖滤;非侵入性(是否被框架綁架):通過配置的方法崩溪,使代碼中不引用框架的類,刪除jar包后不會報錯斩松;
控制反轉(zhuǎn)伶唯、依賴注入:將設(shè)計好的對象交給容器,該對象的屬性也由容器進(jìn)行注入惧盹;
面向切面編程:
容器:管理Java對象(所有的類)的生命周期乳幸;
框架:使用簡單的組件配置組合成一個復(fù)雜的應(yīng)用瞪讼;
一站式:在IOC和AOP基礎(chǔ)上可以整合各種企業(yè)的開源框架和第三方類庫,Spring本身也提供了視圖層的SpringMVC和持久層的Spring JDBC粹断;


相關(guān)術(shù)語

Ioc(控制反轉(zhuǎn) Inversion of Control)
Di(依賴注入 Dependency Injection)
Aop(面向切面編程 Aspect Oriented Programming)
以上都是一種方法論符欠,不是Spring專有
Dao(數(shù)據(jù)訪問對象 Data Access Object)
Orm(對象關(guān)系映射 (Object Relational Mapping)
Service(服務(wù)、業(yè)務(wù)邏輯 等于 Business)
MVC(模型-視圖-控制器 Model View Controller)


IOC—控制反轉(zhuǎn)瓶埋、DI—依賴注入

把創(chuàng)建實例的控制權(quán)交給框架希柿,由框架創(chuàng)建實例(控制反轉(zhuǎn))并把實例分發(fā)給調(diào)用的程序(依賴注入)。由Spring容器來控制對象的生命周期养筒,默認(rèn)是單例模式的曾撤,目的是層和層之間的解耦。

如何實現(xiàn)的解耦

依賴:如果在一個類中想要調(diào)用另一個對象的非靜態(tài)方法晕粪,必須先創(chuàng)建這個對象挤悉,不創(chuàng)建時編譯報錯,此時就稱這個對象是這個類的依賴巫湘。
某一個類中的依賴在正常編譯的情況下装悲,這個類才有可能正常編譯。由此尚氛,便產(chǎn)生了耦合诀诊。
IOC為此而生,不管所依賴的對象是否存在怠褐,都能夠編譯成功:
通過實現(xiàn)接口的方式(面向接口編程)畏梆,類中不再聲明實現(xiàn)類您宪,而是聲明該類的接口奈懒。

IOC示例代碼

  • 新建Java項目
  • 導(dǎo)入相關(guān)jar包:Spring框架jar包及commons-logging.jar(https://mvnrepository.com/下載)
  • 創(chuàng)建接口
package t;

public interface HelloWorld
{
    public void sayHello();
}

  • 創(chuàng)建實現(xiàn)類
package t;

public class HelloWorldImpl implements HelloWorld
{
    @Override
    public void sayHello()
    {
        System.out.println("helloworld");
    }
}
  • 編寫配置文件
<?xml version="1.0" encoding="utf-8"?>
<!-- 上面為xml文件的頭,指明xml的版本號和當(dāng)前文件的編碼宪巨,必須在第一行 -->
<!-- 聲明spring配置文件的跟標(biāo)簽beans -->
<!-- 通過xmlns這個命名空間屬性聲明當(dāng)前xml文檔需要用到的標(biāo)簽所在的包 -->
<!-- xmlns:xsi聲明xsi屬性前綴所在的命名空間 -->
<!-- xsi:schemaLocation聲明當(dāng)前xml文件里用標(biāo)簽的合法性校驗 -->
<!-- xsi:schemaLocation屬性的值包含“命名空間和校驗文件” -->
<!-- 擴展名是xsd的文件是xml的語法校驗文件 -->
<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-4.0.xsd">

<!-- 用bean標(biāo)簽聲明一個HelloWorldImpl類的實例磷杏, 并且把實例的名字定義為helloWorld-->
<!-- 其中需要注意,class屬性里一定是實現(xiàn)類捏卓;id屬性在整個配置文件里必須唯一-->
    <bean id="helloWorld" class="t.HelloWorldImpl"/>

</beans>
  • 編寫測試類
package t;

import org.springframework.context.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test
{
    public static void main(String[] args)
    {
        //通過src目錄(即classpath)下的t目錄下的IOC.xml配置文件极祸,創(chuàng)建spring容器
        AbstractApplicationContext applicationContext = new ClassPathXmlApplicationContext("t/IOC.xml");
        //去容器里取到id=helloWorldBean的實例,并且把這個實例聲明為接口的類型
        HelloWorldImpl bean = (HelloWorldImpl)applicationContext.getBean("helloWorld");
        bean.sayHello();
        applicationContext .close();//關(guān)閉容器
    }
}

DI(依賴注入)

把有依賴關(guān)系的類的實例注入為指定類的屬性值怠晴。
需要注入的類和被注入的類都需要交個Spring容器來管理遥金。
在Controller層中聲明service層的接口,注入service的實現(xiàn)類蒜田,在Service層中注入Dao層的接口稿械,注入dao的實現(xiàn)類。


構(gòu)造器注入
  • 有一個屬性
  • 屬性要在構(gòu)造方法中被賦值
  • 創(chuàng)建需要有屬性被注入的類
public class TextPrinter {
    private Formater formater;//該屬性被注入
    private int size;
    
    public TextPrinter(Formater formater,int size){
        this.formater=formater;
        this.size=size;
    }

    public void print(String info){
        System.out.println("Set size="+this.size);
        this.formater.execute(info);
    }
}
  • 注入屬性的類
public class Formater {
    public void execute(String info) {
        System.out.println("Formater = "+info);
    }
}
  • 配置文件里冲粤,配置注入標(biāo)簽
<!-- 聲明id為f的bean實例 -->
<bean id="f" class="s1.Formater"/>
<!-- 聲明id為tp的bean實例 -->
<bean id="tp" class="s1.TextPrinter">
<!-- 通過constructor-arg調(diào)用tp實例的構(gòu)造方法進(jìn)行注入 -->
<!--
index : 標(biāo)明構(gòu)造方法里參數(shù)的下標(biāo)美莫,即為第幾個參數(shù)注入
ref子標(biāo)簽代表注入一個實例(引用)页眯;bean : 指明一個已經(jīng)在配置文件中配置好的bean的id
type : 標(biāo)明這個參數(shù)的類型
value : 直接給這個參數(shù)注入一個具體的值
-->
    <constructor-arg index="0">
        <ref bean="f"/>
    </constructor-arg>
    <constructor-arg index="1" type="int" value="5"/>
</bean>
  • 寫測試類測試上面的注入結(jié)果
AbstractApplicationContext context = new ClassPathXmlApplicationContext("f.xml");
TextPrinter bean = (TextPrinter) context.getBean("tp");
bean.print("Spring 4");
context.close();
屬性注入
  • 有至少一個屬性
  • 這個屬性至少有公有set方法
  • 創(chuàng)建需要有屬性被注入的類
public class TextPrinter2 {
    private Formater formater;//被注入的屬性
    private int size;//被注入的屬性

    public Formater getFormater() {
        return formater;
    }

    //一定要有這個方法
    public void setFormater(Formater formater) {
        this.formater = formater;
    }

    public int getSize() {
        return size;
    }
    //一定要有這個方法
    public void setSize(int size) {
        this.size = size;
    }

    public void print(String info){
        System.out.println("Set size="+this.size);
        this.formater.execute(info);
    }
}
  • 注入屬性的類 參照上面
  • 配置文件里配置屬性注入標(biāo)簽
...
<bean id="tp2" class="s1.TextPrinter2">
<!--
通過property標(biāo)簽進(jìn)行屬性注入
name : 標(biāo)明類里被注入的屬性的變量名
ref子標(biāo)簽同上
value子標(biāo)簽 type屬性同上
-->
    <property name="formater">
        <ref bean="f"/>
    </property>
    <property name="size">
        <value type="int">5</value>
    </property>
</bean>
...
  • 寫測試類測試上面的屬性注入結(jié)果 參考上面
集合類型的注入
  • 數(shù)組
  • list
  • set
  • map
  • Properties
  • 創(chuàng)建需要有集合屬性被注入的類
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class Department {
    private String name;
    private String [] empName;//數(shù)組
    private List<Employee> empList;//list集合
    private Set<Employee> empsets;//set集合
    private Map<String,Employee> empMaps;//map集合
    private Properties pp;//Properties的使用

    public Set<Employee> getEmpsets() {
        return empsets;
    }
    public void setEmpsets(Set<Employee> empsets) {
        this.empsets = empsets;
    }
    public String[] getEmpName() {
        return empName;
    }
    public void setEmpName(String[] empName) {
        this.empName = empName;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public List<Employee> getEmpList() {
        return empList;
    }
    public void setEmpList(List<Employee> empList) {
        this.empList = empList;
    }
    public Map<String, Employee> getEmpMaps() {
        return empMaps;
    }
    public void setEmpMaps(Map<String, Employee> empMaps) {
        this.empMaps = empMaps;
    }
    public Properties getPp() {
        return pp;
    }
    public void setPp(Properties pp) {
        this.pp = pp;
    }
}
  • 創(chuàng)建集合里元素的實例類
public class Employee {
    private String id;
    private String name;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
  • 在配置文件中配置集合屬性的注入
...
    <!-- 聲明被注入的實例emp1 -->
    <bean id="emp1" class="s1.Employee">
        <property name="name" value="北京"/>
        <property name="id" value="1"/>
    </bean>
    <!-- 聲明被注入的實例emp2 -->
    <bean id="emp2" class="s1.Employee">
        <property name="name" value="天津"/>
        <property name="id" value="2"/>
    </bean>


    <bean id="department" class="s1.Department">
        <!-- 用list子標(biāo)簽給數(shù)組注入值 -->
        <property name="empName">
            <list>
                <value>小明</value>
                <value>小明小明</value>
                <value>小明小明小明小明</value>
            </list>
        </property>
        
        <!-- 用list子標(biāo)簽給list集合屬性注入,注入的是Employee類的實例 -->
        <property name="empList">
            <list>
                <ref bean="emp2"/>
                <ref bean="emp1"/>
                <ref bean="emp1"/>
                <ref bean="emp1"/>
                <ref bean="emp1"/>
                <ref bean="emp1"/>
                <ref bean="emp1"/>
            </list>
        </property>
        
        <!-- 用set子標(biāo)簽給set集合屬性注入厢呵,注入的是Employee類的實例 -->
        <property name="empsets">
            <set>
                <ref bean="emp1"/>
                <ref bean="emp2"/>
                <ref bean="emp2"/>
                <ref bean="emp2"/>
                <ref bean="emp2"/>
            </set>
        </property>
        
        <!-- 用map和entry子標(biāo)簽給map集合屬性注入窝撵,注入的是Employee類的實例,同時給每個實例一個key -->
        <property name="empMaps">
            <map>
                <entry key="11" value-ref="emp1"/>
                <entry key="22" value-ref="emp2"/>
                <entry key="22" value-ref="emp1"/>
            </map>
        </property>
        
        <!-- 用給props和prop子標(biāo)簽給property屬性集合注入襟铭,注入的key和value都是String -->
        <property name="pp">
            <props>
                <prop key="pp1">abcd</prop>
                <prop key="pp2">hello</prop>
            </props>
        </property>
        </bean>
...
  • 寫測試類測試上面的集合屬性注入結(jié)果
...
        Department department=(Department) context.getBean("department");
        for(String emName:department.getEmpName()){
            System.out.println(emName);
        }
 
        System.out.println("**********取出list集合數(shù)據(jù)*****");
        for(Employee e : department.getEmpList()){
            System.out.println("name="+e.getName()+" "+e.getId());
        }

        System.out.println("**********取出set集合數(shù)據(jù)*****");
        for(Employee e : department.getEmpsets()){
            System.out.println("name="+e.getName());
        }
    
        System.out.println("*******取出map集合數(shù)據(jù)方法一****");  
        Map<String,Employee> empmaps=department.getEmpMaps();
        Iterator it=empmaps.keySet().iterator();
        while(it.hasNext()){
            String key=(String) it.next();
            Employee emp=empmaps.get(key);
            System.out.println("key="+key+" "+emp.getName());
        }
        System.out.println("*******取出map集合數(shù)據(jù)方法二****");
        Set<Map.Entry<String, employee>> entries =         department.getEmpMaps().entrySet();
        for (Map.Entry<String, employee> e:entries
             ) {
            System.out.println(e.getKey()+"   "+e.getValue().getId()+"                     "+e.getValue().getName());
        }
        System.out.println("*******取出map集合數(shù)據(jù)方法三****");
        Set<String> keySet = department.getEmpMaps().keySet();
        for (String s:keySet
        ) {
            System.out.print(s+"    ");
            employee employee = d.getEmpmap().get(s);
            System.out.println(employee.getId()+"    "+employee.getName());
        }

        System.out.println("**********取出Properties數(shù)據(jù)*****");
        Properties pp = d.getPp();
        System.out.println(pp.getProperty("name"));
        System.out.println(pp.getProperty("url"));
        Enumeration<?> enumeration = pp.propertyNames();
        while(enumeration.hasMoreElements()){
            System.out.println(enumeration.nextElement());
}

...
注解的方式

語法 : @注解名("參數(shù)")

用注解不能有構(gòu)造器碌奉,否則會報錯

ioc,替代bean標(biāo)簽的注解

@Component - 其他類
@Controller - servlet
@Service - service
@Repository - dao
注解在class聲明上方蝌矛,同樣的功能道批,分四個單詞,不同層的類用不同單詞類注解

@Service("MyBean") 相當(dāng)于 <bean id="MyBean" class="被注解的類"/>

@Service("MyBean")
public class DIHW {
    private HelloWorld hImpl;
    public void print(){
        hImpl.sayHello(" d i ");
    }
}
di入撒,替代property和ref標(biāo)簽的注解
  • @Resource - javax
  • @AutoWired @Qualifier - spring
    注解在需要被注入的屬性上面隆豹,可以聲明被注入實例的id,或者默認(rèn)

[@Resource(name="MyBean")] 相當(dāng)于
[@AutoWired @Qualifier("hello313Impl")] 相當(dāng)于
<property name="注解下面的屬性名">
<ref bean="MyBean"/>
</property>

    @Autowired
    @Qualifier("MyBean")
    或
    @Resource(name="MyBean")
    //@Resource(type=MyBean.class)
    private HelloWorld hImpl;
di注解默認(rèn)的注入規(guī)則

AutoWired注解的默認(rèn)規(guī)則——按照接口類型自動裝配
只寫這個注解茅逮,產(chǎn)生的id按照駝峰命名法命名璃赡,按照被注入的屬性的接口類型來找實例,如果找不到献雅,或找到多個都報錯碉考;
如果想按照名字來找實例,或者有多個類實現(xiàn)這個接口挺身,必須引入Qualifier注解

Resource注解的默認(rèn)規(guī)則——按照屬性名自動裝配
1.如果同時指定了name和type侯谁,則從Spring上下文中找到唯一匹配的bean進(jìn)行裝配,找不到則拋出異常章钾。
2.如果指定了name墙贱,則從上下文中查找名稱(id)匹配的bean進(jìn)行裝配,找不到則拋出異常贱傀。
3.如果指定了type惨撇,則從上下文中找到類似匹配的唯一bean進(jìn)行裝配,找不到或是找到多個府寒,都會拋出異常魁衙。
4.如果既沒有指定name,又沒有指定type株搔,則自動按照byName方式進(jìn)行裝配;如果沒有匹配在按照類型裝配纵隔。

自動裝配和掃描

spring配置文件的頭部的通用定義帆卓,如果要使用注入米丘,要引入新的命名空間和新的校驗文件

<?xml version="1.0" encoding="UTF-8"?>
...
<beans xmlns="http://www.springframework.org/schema/beans" 
xmlns:context="http://www.springframework.org/schema/context"
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-4.0.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-4.0.xsd
">  
...
</beans>

啟動注解拄查,并且自動掃描那個類被注解堕扶,需要在spring的配置文件中添加標(biāo)簽

...
<context:annotation-config/>
<!--聲明4個類幫助系統(tǒng)識別注解-->
<context:component-scan base-package="要掃描的包"/>
<!--使用 <context:component-scan/> 后,就可以將 <context:annotation-config/> 移除了--!>
...

AOP—面向切面編程(對事務(wù)進(jìn)行控制)

多個類中有相同的代碼塊梭依,為減少代碼量稍算,將此代碼塊取出,作為一個切面役拴,切面的前后位置叫做切點糊探,將此切面交給Spring框架管理,自動執(zhí)行此段代碼河闰,減少了方法中的代碼量科平。

相關(guān)概念

1.切面(Aspect):需要插入的代碼塊
2.連接點(JoinPoint):
3.切點(Pointcut):指定某個方法作為切面切的地方
4.通知(Advice):指定切面在切點的插入位置

前置通知(before advice)
后置通知(after return advice)
環(huán)繞通知(around advice)
異常通知(after throwing advice)

5.目標(biāo)對象(target object)
6.AOP代理(aop proxy)

XML和注解方式AOP

xml方式
  • 新建兩個類
//被切入的類
public class Car {
    public void go(){
        System.out.println("go go go!");
    }
}
//存放切入代碼的類
public class CarLogger {
    public void beforeRun(){
        System.out.println("之前");
    }
    public void afterRun(){
        System.out.println("之后");
    }
}
  • 創(chuàng)建spring配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">
<bean id="car" class="aop.Car" />
<bean id="logger" class="aop.CarLogger" />
<aop:config>
    <aop:aspect ref="logger">
    <aop:pointcut expression="execution(* aop.Car.go(..))" id="go"/>
     <!--切點表達(dá)式:找到切點,“..”為參數(shù)任意姜性〉苫郏“*”為返回值任意-->
            <aop:before pointcut-ref="go" method="beforeRun" />
            <aop:after pointcut-ref="go" method="afterRun" />
        </aop:aspect>
</aop:config>
</beans>
  • 創(chuàng)建測試類
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TestAop {
    public static void main( String[] args ){
        ApplicationContext context = new ClassPathXmlApplicationContext("aop-config.xml");
        Car car=(Car) context.getBean("car");
        car.go();
    }
}
注解方式
  • 同上新建兩個類
  • 修改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"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-4.0.xsd 
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop-4.0.xsd">
<bean id="car" class="aop.Car" />
<bean id="logger" class="aop.CarLogger" />
<!--自動完成創(chuàng)建代理織入切面的工作-->
<aop:aspectj-autoproxy/>
</beans>
  • 修改CarLogger類如下
@Aspect
public class CarLogger {
    @Before("execution(* aop.Car.go(..))")
    public void beforeRun(){
        System.out.println("之前");
    }
    @After("execution(* aop.Car.go(..))")
    public void afterRun(){
        System.out.println("之后");
    }
}

@Aspect
public class CarLogger {
    @Pointcut("execution(* aop.Car.go(..))")
    public void anyMethod(){}
    
    @Before("anyMethod()")
    public void beforeRun(){
        System.out.println("之前");
    }
    @After("anyMethod()")
    public void afterRun(){
        System.out.println("之后");
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市部念,隨后出現(xiàn)的幾起案子弃酌,更是在濱河造成了極大的恐慌,老刑警劉巖儡炼,帶你破解...
    沈念sama閱讀 211,265評論 6 490
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件妓湘,死亡現(xiàn)場離奇詭異,居然都是意外死亡射赛,警方通過查閱死者的電腦和手機多柑,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,078評論 2 385
  • 文/潘曉璐 我一進(jìn)店門奶是,熙熙樓的掌柜王于貴愁眉苦臉地迎上來聂沙,“玉大人沮趣,你說我怎么就攤上這事房铭∥毯” “怎么了露懒?”我有些...
    開封第一講書人閱讀 156,852評論 0 347
  • 文/不壞的土叔 我叫張陵辩诞,是天一觀的道長荞怒。 經(jīng)常有香客問我褐桌,道長,這世上最難降的妖魔是什么啦撮? 我笑而不...
    開封第一講書人閱讀 56,408評論 1 283
  • 正文 為了忘掉前任,我火速辦了婚禮织中,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘刁笙。我一直安慰自己座每,他們只是感情好尺栖,可當(dāng)我...
    茶點故事閱讀 65,445評論 5 384
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著挫以,像睡著了一般掐松。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上杠愧,一...
    開封第一講書人閱讀 49,772評論 1 290
  • 那天,我揣著相機與錄音腌闯,去河邊找鬼糖声。 笑死蘸泻,一個胖子當(dāng)著我的面吹牛蟋恬,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播沐绒,決...
    沈念sama閱讀 38,921評論 3 406
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼蹋肮!你這毒婦竟也來了坯辩?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,688評論 0 266
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎系瓢,沒想到半個月后阵赠,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,130評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡枷邪,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,467評論 2 325
  • 正文 我和宋清朗相戀三年腹泌,在試婚紗的時候發(fā)現(xiàn)自己被綠了凉袱。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,617評論 1 340
  • 序言:一個原本活蹦亂跳的男人離奇死亡钉稍,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出蒙袍,到底是詐尸還是另有隱情瘾蛋,我是刑警寧澤哺哼,帶...
    沈念sama閱讀 34,276評論 4 329
  • 正文 年R本政府宣布无宿,位于F島的核電站蹂午,受9級特大地震影響豆胸,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜估盘,卻給世界環(huán)境...
    茶點故事閱讀 39,882評論 3 312
  • 文/蒙蒙 一攀细、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧肢藐,春花似錦、人聲如沸理盆。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,740評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽环葵。三九已至,卻和暖如春菊卷,著一層夾襖步出監(jiān)牢的瞬間洁闰,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 31,967評論 1 265
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留耸弄,地道東北人卓缰。 一個月前我還...
    沈念sama閱讀 46,315評論 2 360
  • 正文 我出身青樓计呈,卻偏偏與公主長得像砰诵,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子捌显,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 43,486評論 2 348

推薦閱讀更多精彩內(nèi)容

  • 說明:本文主要內(nèi)容來自慕課網(wǎng)茁彭。配合視頻食用口味更佳。主要是順著已經(jīng)學(xué)習(xí)的視頻順序總結(jié)一遍扶歪,以深化理解和方便日后復(fù)習(xí)...
    stoneyang94閱讀 849評論 3 5
  • 前言 前面已經(jīng)學(xué)習(xí)了Struts2和Hibernate框架了浮声。接下來學(xué)習(xí)的是Spring框架...本博文主要是引入...
    Java3y閱讀 29,065評論 3 36
  • 控制反轉(zhuǎn): 把創(chuàng)建對象的權(quán)利交給框架,在使用過程中直接去得到這個對象帽揪;它包括依賴注入(Dependency Inj...
    _Sisyphus閱讀 238評論 1 1
  • Spring入門IOC和AOP學(xué)習(xí)筆記 1. 概述 Spring框架的核心有兩個: Spring容器作為超級大工廠...
    王小冬閱讀 376評論 0 2
  • 一直都在看別人寫的文章实胸,總是去相信別人的言論,別人對人生的見解與領(lǐng)悟染乌。細(xì)細(xì)想來譬挚,我們每個人都在生活漆腌,都有同樣的一天...
    在南方的天空里仰望北方閱讀 153評論 0 0