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:wsconfig.PaysRepository.java

/**
 * Renvoye la liste des pays en fonction de leurs dangerosit
 * @param danger True pour les pays dangereux, false sinon
 * @return La liste de pays correspondant
 *///from   ww  w.  j  av  a  2s  . c o m
public List findAllPaysDanger(boolean danger) {

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

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

From source file:TopicsTest.java

@Test
public void testJDBCTemplateInsertPersonne() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopics m = (ITopics) bf.getBean("topicsDao");
    System.out.print("Je suis ici");
    List<Topics> u = m.findAllById(1);
    System.out.print("Je suis ici");
    for (Topics p : u) {
        System.out.println("nom=" + p.getUsername());
    }/*from   w ww.jav a2  s  .  c o m*/

}

From source file:TopicsTest.java

@Test
public void testJDBCTemplaUpdateNbCommentairse() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopics m = (ITopics) bf.getBean("topicsDao");
    System.out.print("Je suis ici");
    List<Topics> to = m.findByTopicId(4);
    for (Topics t : to) {
        System.out.println(t.getTopic_description());
    }//www  .ja  v a  2s .  c o m
    //System.out.print(to.getTopic_desc() + "" + to.getCat_id());

}

From source file:wsconfig.PaysRepository.java

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

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

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

From source file:wsconfig.PaysRepository.java

/**
 * Renvoye un pays trouv dans la base de donne
 * @param id L'ID du pays que l'on veut trouver
 * @return Le pays correspondant//from  www. j ava2 s. c o  m
 */
public Pays findPays(int id) {

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

    Pays result = new Pays();
    try {
        result = instance.findPays(id);
        System.out.println("libelle get : " + result.getLibelleFr() + " ID: " + result.getID());
    } catch (PaysNotFoundException e) {
        e.printStackTrace();
    }
    return result;
}

From source file:wsconfig.PaysRepository.java

/**
 * Renvoye un pays trouv dans la base de donne
 * @param name Le nom du pays que l'on veut trouver
 * @return Le pays correspondant/* ww  w  .ja v  a  2s  .c om*/
 */
public Pays findPays(String name) {

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

    Pays result = new Pays();
    String libelle = name;
    try {
        result = instance.findPays(libelle);
        System.out.println("libelle get : " + result.getLibelleFr());
    } catch (PaysNotFoundException e) {
        e.printStackTrace();
    }
    return result;
}

From source file:wsconfig.PaysRepository.java

/**
 * Renvoie une liste de pays en fonction de differement paramettre 
 * @param arg Map qui peut contenir des valeurs avec les cls suivante pour construir une requete:
 * libelle: pour les libelles qu'on cherches
 * indicatif: pour les indicatif qu'on cherches
 * monnaie_code: pour les monnaie code qu'on cherche
 * monnaie_perdiem: pour les monnaie perdiem
 * monnaie_perdiem_arg: doit contenir "+" si on cherche les monnaie perdiem superieur, ou "-" si inferieur
 * taux_change: pour les taux change//from  w ww . j ava2s.c om
 * taux_change_arg: doit contenir "+" si on cherche les taux change superieur, ou "-" si inferieur
 * @return La liste des pays correspondant qui rponds aux arguments donnes
 */
public List findListPays(HashMap<String, String> arg) {

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

    List<Pays> result = null;
    try {
        result = instance.findListPays(arg);
        for (Pays pays : result) {
            System.out.println("libelle : " + pays.getLibelleFr());
        }
    } catch (PaysNotFoundException e) {
        e.printStackTrace();
    }

    return result;
}

From source file:TopicsTest.java

@Test
public void testJDBCTemplaFindById() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopicsMetier m = (ITopicsMetier) bf.getBean("topicsMetier");
    System.out.print("Je suis ici");
    List<Topics> to = m.findAllById(1);

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

From source file:TopicsTest.java

@Test
public void testJDBCTemplaUpdateNbCommentaire() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopicsMetier m = (ITopicsMetier) bf.getBean("topicsMetier");
    System.out.print("Je suis ici");
    m.UpdateNumberTopics(1);//from w w  w.j  av  a  2 s .  c om

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

From source file:TopicsTest.java

@Test
public void testJDBCTemplaTchangeType() {

    ListableBeanFactory bf;
    bf = new XmlBeanFactory(new ClassPathResource("applicationContext.xml"));
    ITopicsMetier m = (ITopicsMetier) bf.getBean("topicsMetier");

    m.change_prive_topic(6);/*from   ww w  .  j  a  v a2s.  c  o m*/
    m.change_public_topics(6);

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