It works fine under eclipse environment as following on Spring annotation:
main code:
ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "com/jgk/spring3/simple/resource/simple-annotated.xml",});
SimpleResourcePojo pojo = (SimpleResourcePojo) context.getBean("simpleResourcePojo");
and SimpleResourcePojo define:
package com.jgk.spring3.simple.resource;
@Component("simpleResourcePojo")
public class SimpleResourcePojo {
simple-annotated.xml:
<context:component-scan base-package="com.jgk.spring3.simple.resource"/>
But when I try to deploy code to run with java command like:
java -classpath .;lib\* com.jgk.spring3.simple.resource.CheckSpringResourc e
Then get error message about "No bean named 'simpleResourcePojo' is defined"
Any one know what happened? how to set classpath?


Reply With Quote