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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -