Example usage for org.springframework.beans.factory ListableBeanFactory getBean

List of usage examples for org.springframework.beans.factory ListableBeanFactory getBean

Introduction

In this page you can find the example usage for org.springframework.beans.factory ListableBeanFactory getBean.

Prototype

Object getBean(String name) throws BeansException;

Source Link

Document

Return an instance, which may be shared or independent, of the specified bean.

Usage

From source file:CommentTest.java

@Test
public void InsertCommentTest() {

    ListableBeanFactory bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ICommentaireDao m = (ICommentaireDao) bf.getBean("commentaireDao");
    Commentaire co = new Commentaire();
    co.setUsername("users");
    co.setComment_text("TESTE DESZDZ L'ATTRIBUT VALIDATION ! ");
    co.setCat_id(1);/*from www  .java 2s.  c om*/
    co.setTopic_id(2);

    m.InsertNewCommentaire(co);

}

From source file:CategorieTest.java

@Test
public void testJDBCInsertCategorie() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ICategorieDao m = (ICategorieDao) bf.getBean("categorieDao");
    if (m.existeCategorie("musique")) {
        System.out.println("Existe dj");
    } else {//w w w .  j ava 2s.com
        m.InsertCategorie("musique");
        System.out.println("Existe pas");
    }

}

From source file:CategorieTest.java

@Test
public void testJDBCTemplate() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ICategorieDao m = (ICategorieDao) bf.getBean("categorieDao");
    System.out.print("Je suis ici");
    List<Categorie> u = m.findAllC();
    System.out.print("Je suis ici");

    for (Categorie p : u) {
        System.out.println("nom=" + p.getCat_id());
    }/*  w  w  w  .j av  a 2s  . c  om*/

}

From source file:CategorieTest.java

@Test
public void testJDBCFindAllById() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ICategorieMetier m = (ICategorieMetier) bf.getBean("categorieMetier");
    System.out.print("Je suis ici");
    List<Categorie> u = m.findAllC();
    System.out.print("Je suis ici");

    for (Categorie p : u) {
        System.out.println("nom=" + p.getCat_id());
    }//  w  w  w . j  av a 2  s.  c om

}

From source file:CommentTest.java

@Test
public void findAllCommentTest() {
    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ICommentaireDao m = (ICommentaireDao) bf.getBean("commentaireDao");
    System.out.print("Je suis ici");
    List<Commentaire> u = m.findAll();
    System.out.print("Je suis ici");

    for (Commentaire p : u) {
        System.out.println("nom=" + p.getComment_text());
    }/*  w w w.  j ava2  s.c om*/

}

From source file:CommentTest.java

@Test
public void findAllCommentTestByTopicId() {
    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ICommentaireMetier m = (ICommentaireMetier) bf.getBean("commentaireMetier");
    List<Commentaire> u = m.findAllByIdTopics(38);
    System.out.print("Je suis ici");

    for (Commentaire p : u) {
        System.out.println("nom=" + p.getComment_text());
    }//  w  ww .  j a  va 2s .c o  m
    if (u.isEmpty()) {
        System.out.println("LA LISTE EST  VIDE !");
    }

}

From source file:TopicsTest.java

@Test
public void testJDBCUpdateDateDerComment() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopics m = (ITopics) bf.getBean("topicsDao");
    System.out.print("Je suis ici");
    m.UpdateDateLastComment(36);// w  ww .  j a v a 2s.c o  m

    //System.out.print(to.getTopic_desc() + "" + to.getCat_id());
}

From source file:TopicsTest.java

@Test
public void testJDBCUpdateUsernameDerComment() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopics m = (ITopics) bf.getBean("topicsDao");
    System.out.print("Je suis ici");
    m.UpdateUsernameLastComment(36, "anthony");

    //System.out.print(to.getTopic_desc() + "" + to.getCat_id());
}

From source file:TopicsTest.java

@Test
public void testJDBCUpdateNumberCommentByTopics() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopics m = (ITopics) bf.getBean("topicsDao");
    System.out.print("Je suis ici");
    m.UpdateNumberComment(36);//from  w  ww.j av a  2s.co m

    //System.out.print(to.getTopic_desc() + "" + to.getCat_id());
}

From source file:wsconfig.PaysRepository.java

/**
 * Renvoye la liste de tout les pays prsent dans la base de donne
 * @return La liste de tout les pays//  w  w  w.j av  a  2s.  c o  m
 */
public List findAllPays() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    IPaysMetier instance = (IPaysMetier) bf.getBean("paysMetier");

    List<Pays> result = instance.findAllPays();
    for (Pays pays : result) {
        System.out.println("libelle : " + pays.getLibelleFr());
    }
    return result;
}