Home  >  Q&A  >  body text

java - controller中的this代表什么呀?并不会创建对象啊?

天蓬老师天蓬老师2742 days ago536

reply all(3)I'll reply

  • 黄舟

    黄舟2017-04-18 10:58:11

    this represents the instance object of the current class. The current class is hosted by Spring. Spring creates the instance object of the class through the reflection mechanism, so we do not need to explicitly use the key value new to create the instance object of the class

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 10:58:11

    Beans in spring are singletons by default, so this refers to the controller object

    reply
    0
  • 高洛峰

    高洛峰2017-04-18 10:58:11

    The controller class object is created and hosted by spring for you, and is a singleton by default

    reply
    0
  • Cancelreply