XmlBeanFactory.doCreateBean does not autowire

but DefaultListableBeanFactory.doCreateBean does autowire 

:(



yan da zhi wrote:
> 
> This Case,UserMange works good,BaseManagerTestCase extends
> AbstractTransactionalJUnit4SpringContextTests,I donot kwon how it works,
> but Junit is pass.
> 
> public class UserManagerTest extends BaseManagerTestCase {
>     private Log log = LogFactory.getLog(UserManagerTest.class);
>     @Autowired
> private UserManager mgr;//-------this mgr works good!
> ==========================
> But In This Case:
> 
> public static void main(String[] args) {
>            BeanFactory beanFactory = new XmlBeanFactory(new
> ClassPathResource(
>                   "applicationContext.xml"));
>            UserManager mgr =              //-------------this mgr works
> bad, it can not get dao!
>         (UserManager) beanFactory.getBean("userManager");
>     }
> 
> 
> 
> UserManger can not load UserDao, The Dao is null;
> 
> Yes,I check applicationContext.xml, Manger and Dao has  not relationship.
> 
> all of these code is same project ,same applicationContext.xml.
> 
> But ,why Manger and Dao has relationship in TestCase?
> 
> How to use UserManger In No-TestCase Class ‘s main fuction?
> 
> 
> My English is poor,but I will thanks for any help.
> 
> BRs
> 
> Johnydz
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Spring-Annotation-%27s-question-tp24563205s2369p24566483.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to