The Finder can locate the target serverresource and effectively process the request.
1. Finder manages the entire lifecycle of the serverresource subclass The default Implementation of finder is to use gettargetclass () to obtain the name of the serverresource subclass stored in the targetclass attribute of the finder class. First, the finder instantiates the instance of the serverresource subclass, and then calls the serverresource. INIT (context, request, response) method. After the instance is created successfully, serverresource. Handle () processes the request. After the request processing is complete, call serverresource. Release () to release the resource. By default, the server resource subclass must be re-created for each request. When the request enters the handle () method, the finder first looks for the name of the serverresource subclass, then instantiates this class, and calls the init (), handle (), and release () methods of this class in sequence. The Finder stores the name of the serverresource subclass in the targetclass attribute. The type of this attribute is class. Therefore, each finder instance can only store a corresponding serverresource subclass name. Therefore, a finder instance or a finder subclass instance corresponds to a serverresource subclass instance, that is, the relationship between the finder and serverresource is one-to-one.
II,Springbeanfinder Springfinder is a subclass of finder and springbeanfinder is a subclass of springfinder. Springbeanfinder implements the beanfactoryaware and applicationcontextaware interfaces of spring and instantiates the target class using spring. Compared with the default Implementation of finder, the configuration and flexibility are enhanced. In springbeanfinder, you can save the beanname to find the serverresource subclass instance.