IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

[Core][Autowiring] No unique bean of type [service.AdresseDAO] is defined


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Inscrit en
    Août 2008
    Messages
    35
    Détails du profil
    Informations forums :
    Inscription : Août 2008
    Messages : 35
    Par défaut [Core][Autowiring] No unique bean of type [service.AdresseDAO] is defined
    Bonjour

    Je suis entrain de developper une application utilisant jpa spring et jsf

    J'utilise la notion de facade (interface ou sont déclarer toutes mes methodes) et facadeImp qui l'implémente.

    Quand j'injecte avec l'aide de string plus d'un DAO avec le @Autowired j'ai l'exception:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facade': Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void service.FacadeImpl.setAdresseDAO(service.AdresseDAO); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [service.AdresseDAO] is defined: Unsatisfied dependency of type [interface service.AdresseDAO]: expected at least 1 matching bean
    ma FacadeImp est la suivante

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
     
    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    package service;
     
    /**
     *
     * @author doum
     */
    import java.util.List;
    import model.Adresse;
    import model.Annonce;
    import model.Categorie;
    import model.Client;
    import model.Message;
    import model.Pays;
    import model.Photo;
    import model.Ville;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.stereotype.Repository;
     
    @Repository
    public class FacadeImpl implements Facade {
     
        private AnnonceDAO annonceDAO;
        private AdresseDAO adresseDAO;
        private CategorieDAO categorieDAO;
        private ClientDAO clientDAO;
        private MessageDAO messageDAO;
        private PaysDAO paysDAO;
        private VilleDAO villeDAO;
        private PhotoDAO photoDAO;
     
     
        //Injection du dao Adresse
        @Autowired
        public void setAdresseDAO(AdresseDAO adresseDAO) {
            this.adresseDAO = adresseDAO;
        }
     
        public AdresseDAO getAdresseDAO() {
            return this.adresseDAO;
        }
        //Injection du dao Annonce
        @Autowired
        public void setAnnonceDAO(AnnonceDAO annonceDAO) {
            this.annonceDAO = annonceDAO;
        }
     
        public AnnonceDAO getAnnonceDAO() {
            return this.annonceDAO;
        }
        //Injection du dao Categorie
        @Autowired
        public void setCategorieDAO(CategorieDAO categorieDAO) {
            this.categorieDAO = categorieDAO;
        }
     
        public CategorieDAO getCategorieDAO() {
            return this.categorieDAO;
        }
        //Injection du dao Client
        @Autowired
        public void setClientDAO(ClientDAO clientDAO) {
            this.clientDAO = clientDAO;
        }
     
        public ClientDAO getClientDAO() {
            return this.clientDAO;
        }
        //Injection du dao Message
        @Autowired
        public void setMessageDAO(MessageDAO messageDAO) {
            this.messageDAO = messageDAO;
        }
     
        public MessageDAO getMessageDAO() {
            return this.messageDAO;
        }
        //Injection du dao Pays
        @Autowired
        public void setPaysDAO(PaysDAO paysDAO) {
            this.paysDAO = paysDAO;
        }
     
        public PaysDAO getPaysDAO() {
            return this.paysDAO;
        }
        //Injection du dao Ville
        @Autowired
        public void setVilleDAO(VilleDAO villeDAO) {
            this.villeDAO = villeDAO;
        }
     
        public VilleDAO getVilleDAO() {
            return this.villeDAO;
        }
        //Injection du dao Photo
        @Autowired
        public void setPhotoDAO(PhotoDAO photoDAO) {
            this.photoDAO = photoDAO;
        }
     
        public PhotoDAO getPhotoDAO() {
            return this.photoDAO;
        }
        //FIN DE LA PARTIE INJECTION 
     
     
     
        //ADRESSE
     
        public Adresse getAdresse(String adresseID) {
            return adresseDAO.getAdresse(adresseID);
        }
        public int getAdresseCount() {
            return adresseDAO.getAdresseCount();
        }
        public List<Adresse> getAdresses(int firstAdresse, int batchSize) {
            return adresseDAO.getAdresses(firstAdresse, batchSize);
        }
     
     
        //ANNONCE 
     
        public Annonce getAnnonce(String annonceID) {
            return annonceDAO.getAnnonce(annonceID);
        }
        public int getAnnonceCount() {
            return annonceDAO.getAnnonceCount();
        }
        public List<Annonce> getAnnonces(int firstAnnonce, int batchSize) {
            return annonceDAO.getAnnonces(firstAnnonce, batchSize);
        }
     
        //CATEGORIE  
     
        public Categorie getCategorie(String categorieID) {
            return categorieDAO.getCategorie(categorieID);
        }
        public int getCategorieCount() {
            return categorieDAO.getCategorieCount();
        }
        public List<Categorie> getCategories(int firstCategorie, int batchSize) {
            return categorieDAO.getCategories(firstCategorie, batchSize);
        }
     
        //CLIENT    
     
        public Client getClient(String clientID) {
            return clientDAO.getClient(clientID);
        }
        public int getClientCount() {
            return clientDAO.getClientCount();
        }
        public List<Client> getClients(int firstClient, int batchSize) {
            return clientDAO.getClients(firstClient, batchSize);
        }
     
        //MESSAGE    
     
        public Message getMessage(String messageID) {
            return messageDAO.getMessage(messageID);
        }
        public int getMessageCount() {
            return messageDAO.getMessageCount();
        }
        public List<Message> getMessages(int firstMessage, int batchSize) {
            return messageDAO.getMessages(firstMessage, batchSize);
        }
     
        //PAYS 
     
        public Pays getPays(String paysID) {
            return paysDAO.getPays(paysID);
        }
        public int getPaysCount() {
            return paysDAO.getPaysCount();
        }
        public List<Pays> getPayss(int firstPays, int batchSize) {
            return paysDAO.getPayss(firstPays, batchSize);
        }
     
        //PHOTO 
     
        public Photo getPhoto(String photoID) {
            return photoDAO.getPhoto(photoID);
        }
        public int getPhotoCount() {
            return photoDAO.getPhotoCount();
        }
        public List<Photo> getPhotos(int firstPhoto, int batchSize) {
            return photoDAO.getPhotos(firstPhoto, batchSize);
        }
     
        //VILLE 
     
        public Ville getVille(String villeID) {
            return villeDAO.getVille(villeID);
        }
        public int getVilleCount() {
            return villeDAO.getVilleCount();
        }
        public List<Ville> getVilles(int firstVille, int batchSize) {
            return villeDAO.getVilles(firstVille, batchSize);
        }
     
     
    }
    Aidez moi svp

  2. #2
    Expert confirmé
    Avatar de djo.mos
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    4 666
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 4 666
    Par défaut
    Salut,
    L'erreur est explicite :

    No unique bean of type [service.AdresseDAO] is defined
    T'as pas défini un bean de type AdresseDAO dans ton applicationContext.

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Novembre 2007
    Messages
    69
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2007
    Messages : 69
    Par défaut
    Le bean ne doit pas etre présent dans ton context spring.
    Check les fichiers xml.

  4. #4
    Membre éclairé
    Profil pro
    Développeur Java
    Inscrit en
    Novembre 2008
    Messages
    63
    Détails du profil
    Informations personnelles :
    Localisation : France, Hauts de Seine (Île de France)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Novembre 2008
    Messages : 63
    Par défaut
    vérifie aussi si tu n'a fait d'erreur d'annotations dans ton dao.

Discussions similaires

  1. Réponses: 7
    Dernier message: 19/08/2013, 08h33
  2. Réponses: 4
    Dernier message: 03/04/2012, 11h25
  3. [Data] JavaConfig et Autowiring : problème de bean unique
    Par Invité dans le forum Spring
    Réponses: 1
    Dernier message: 22/06/2009, 12h51
  4. error setting property in bean of type null
    Par ouedmouss dans le forum JSF
    Réponses: 8
    Dernier message: 23/01/2007, 12h52
  5. [JSF] Erreur "bean of type null"
    Par vallica dans le forum JSF
    Réponses: 5
    Dernier message: 27/03/2006, 11h57

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo