-
Oct 7th, 2012, 03:29 AM
#1
@Bean is not working
Hi,
I am using @Bean annotation within class annotated with @Component
@Component
public class ClassWithComponentAnnotation {
@Bean
@Qualifier("classCreatedWithInComponentAnnotatedCl ass")
public ClassCreatedWithInComponentAnnotatedClass publicInstance() {
return new ClassCreatedWithInComponentAnnotatedClass();
}
}
-------------------------------------------------------------------------------
Now when i some other class i am doing like below then it is giving me error that bean not found...
ClassCreatedWithInComponentAnnotatedClass classCreatedWithInComponentAnnotatedClass = applicationContext.getBean("classCreatedWithInComp onentAnnotatedClass", ClassCreatedWithInComponentAnnotatedClass.class);
Can you please suggest that what i am doing wrong with,,,,,
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules