猿问

spring扫描到了 为啥没有进行自动装配 报空

ApplicationContext factory=new ClassPathXmlApplicationContext("classpath:applicationContext.xml"); 

String[] s = factory.getBeanDefinitionNames();

for(String ss:s){

System.out.println(ss);

}


userServiceImpl

userController

userDaoImpl

org.springframework.context.annotation.internalConfigurationAnnotationProcessor

org.springframework.context.annotation.internalAutowiredAnnotationProcessor

org.springframework.context.annotation.internalRequiredAnnotationProcessor

org.springframework.context.annotation.internalCommonAnnotationProcessor

org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor#0

org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor

org.springframework.context.annotation.ConfigurationClassPostProcessor.enhancedConfigurationProcessor




@Autowired

private IUserService userService;

public void say(){

userService.say();

}


慕粉3475506
浏览 1487回答 1
1回答

chinesszz

@Autowired是按类型@Resource是根据名字,你看是不是你有重复的类,或者是名字不是首字母小写,
随时随地看视频慕课网APP

相关分类

Java
我要回答