The load statement is as follows:
.....
Static beanfactory;
Public void start (bundlecontext context) throws exception {
Super. Start (context );
Initspring ();
Plugin = this;
}
Private void initspring (){
Classloader oldloader = thread. currentthread (). getcontextclassloader ();
Try {
Object o = This. getclass (). getclassloader ();
Thread. currentthread (). setcontextclassloader (classloader) O );
Beanfactory = new classpathxmlapplicationcontext (
"/Applicationcontext. xml ");
} Finally {
Thread. currentthread (). setcontextclassloader (oldloader );
}
}
Public static beanfactory getbeanfactory (){
Return beanfactory;
}
After the preceding content is added:
Put the modified statement in the start of activator. Because RCP is delayed loading, the required package is not loaded when you need to use the spring container. Therefore, you must load the preceding statements immediately before the activator plug-in is loaded. Create a class to implement istartup. Load the RCP extension point.
Header in the spring configuration file:
<Beans xmlns = "http://www.springframework.org/schema/beans"
Xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns: context = "http://www.springframework.org/schema/context"
Xsi: schemalocation = "http://www.springframework.org/schema/beans
Http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context-2.5.xsd>
The XSD file cannot be found because it cannot connect to the Internet, but the loaded spring. the jar package exists, but the system cannot be associated (the RCP project puts all the jar packages to be used in an agreed plug-in ). This is because, although all the third-party package plug-ins jar are exposed to other plug-ins. handlers cannot be found, so only spring. put the jar package in the plug-in that uses the spring configuration file.
Add the jar package to the classpath for runtime in plugin. xml.
To solve this problem.