The POJO service is instantiated by BTT Element Factory on the
server side. And the instance lifecycle can be specified by the configuration
of the BTT Element Factory, using a attribute named scope. BTT Element Factory
provides the following three options for the scope attribute:
- singleton. It means that there is only one service instance in the server
environment and only one instance for one particular id.
- prototype. It means when the server receives a client request, one instance
of the service is instantiated. And the instance is destroyed after the execution
of the method.
- session. It means the lifecycle of the instance is the same as the session
in the web container, which seems shorter than the singleton but longer than
the prototype.
If the scope of one service is not set, the default value
will follow the global one.