Added init and destroy methods

In order to call destroy method registerShutdownHook() must be called
from context which should have base type AbstractApplicationContext