package config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("POJO")
public class SpringConfig2 {
}
package POJO;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;
@Component
public class Cat {
public Cat() {
System.out.println("testMod---cat");
}
public Cat(String arg){
System.out.println(arg);
}
}
上面是配置了和bean类,下面是测试类
public class Main {
public static void main(String[] args) {
AnnotationConfigApplicationContext context=new AnnotationConfigApplicationContext(SpringConfig2.class);
}
}
项目结构如下

为什么会报错
