Affects: \
Hello! Since eclipse4 rcp's Ioc is just too simple to manage the lifecycle of objects for my needs, I would like to use Spring in eclipse4 rcp to manage my backend business. My test code looks like this:
public class SamplePart {
private TableViewer tableViewer;
@Inject
private MPart part;
@PostConstruct
public void createComposite(Composite parent) {
FileSystemXmlApplicationContext classPathXmlApplicationContext = new FileSystemXmlApplicationContext (
"D:\\test\\application.xml");
Person bean = classPathXmlApplicationContext.getBean(Person.class);
System.out.println(bean);
}
application.xml:
<bean id="person" class="apptest.Person">
<property name="name" value="Mr Catin" />
<property name="gender" value="man"></property>
</bean>
Error at rcp startup: org.eclipse.e4.core.di.InjectionException: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [apptest.Person] for bean with name 'person' defined in file [D:\eclipse\ws\appTest\springConfig\application.xml] at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68) at org.eclipse.e4.core.internal.di.InjectorImpl.processAnnotated(InjectorImpl.java:987) at org.eclipse.e4.core.internal.di.InjectorImpl.internalInject(InjectorImpl.java:141) at org.eclipse.e4.core.internal.di.InjectorImpl.internalMake(InjectorImpl.java:395) at org.eclipse.e4.core.internal.di.InjectorImpl.make(InjectorImpl.java:322) at org.eclipse.e4.core.contexts.ContextInjectionFactory.make(ContextInjectionFactory.java:202) ........
There is no other spring configuration.
I don't understand why this is? How can I use spring to manage my backend business objects in eclipse4 rcp? Which Spring starter class should I use for this? Based on configuration file or annotation is fine, can you help me to solve this problem?
Comment From: bclozel
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. As mentioned in the guidelines for contributing, we prefer to use the issue tracker only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add some more details if you feel this is a genuine bug.