Search code examples
classscalaobjectlift

Why `bootstrap.liftweb.Boot` of Liftweb is a class, other than an object?


In lift application:

package bootstrap.liftweb

class Boot {
    def boot = {}
}

I want to know why Boot is a class not an object? It should be executed only once, so I think object Boot is more reasonable.


Solution

  • object Boot and class Boot have no restrictions on how many times def boot can be executed just how you do so.

    The only thing that may be affected is the instances. class Boot can have more than one instance while object Boot will be a static method. only the object that calls Boot will require to be static.