I am trying to make a Spring Helloworld application, but I get the following exception:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloWorld' defined in class path resource [spring.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/io/support/SpringFactoriesLoader
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:529)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at com.sdnext.dineshonjava.tutorial.SpringJavaApp.main(SpringJavaApp.java:11)
Here are my Maven dependencies : maven dependencies
The SpringFactoriesLoader class is obviously missing from the package, so what should I do? I tried to change the version of the spring-core dependency to 3.2.2, but I get an error in the pom.xml saying Missing artifact org.springframework:spring-core:jar:3.2.2
In my spring.xml configuration file I have declared the following bean :
<bean class="com.sdnext.dineshonjava.tutorial.HelloWorld" id="helloWorld">
<property name="message" value="Hello World!">
I also have the class HelloWorld in that package.
I am thinking that maybe there is a version conflict somewhere, but how can I figure out where is the problem?