java - Use spring beans from Serializable objects -
i need execute task on remote machine.
task dummy runnable or callable , serializable transferred remote host, deserialized , executed there.
need use spring beans task execute on remote machine.
what elegant way 'serialize' bean name when task serialized on client machine , 'deserialize' real bean while deserialization on remote machine?
other solutions?
if have access applicationcontext can ask create instance you, e.g. enable autowiring:
appcontext.getautowirecapablebeanfactory().createbean( beanclass, abstractbeandefinition.autowire_by_type, true)
a more elegant way annotate class @configurable, described here.
Comments
Post a Comment