Spring Annotation 's question

1 message Options
Embed this post
Permalink
johnydz

Spring Annotation 's question

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

This Case,UserMange works good,BaseManagerTestCase extends AbstractTransactionalJUnit4SpringContextTestsI 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;

 

But In This Case:

 

public static void main(String[] args) {

           BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(

                  "applicationContext.xml"));

           UserManager mgr = (UserManager) beanFactory

                  .getBean("userManager");

    }

 

UserManger can not load UserDao, The Dao is null;

 

Yes,I check applicationContext.xml, Manger and Dao has  not relationship.

 

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



聊天+搜索+邮箱 想要轻松出游,手机MSN帮你搞定! 立刻下载!