java - How to load application context from string in Spring 2.5? -
as title says, want load beans string. this approach works in spring 3 because genericxmlapplicationcontext
unavailable in version 2.5.
use approach outlined here. 1 additional step, pass defaultlistablebeanfactory
genericapplicationcontext
(this 1 has been around since spring 1.1 , genericxmlapplicationcontext convenience class doing more or less same in blog post).
so should work
string content = ... genericapplicationcontext ctx = new genericapplicationcontext(); xmlbeandefinitionreader reader = new xmlbeandefinitionreader(ctx); reader.loadbeandefinitions(new bytearrayresource(content.getbytes())); ctx.refresh();
the applicationcontext
should ready use.
Comments
Post a Comment