Bonjour à tous.
J'ai actuellement un projet à réaliser pour l'école et je rencontre un problème lors de la création de mes beans...
En effet je dois faire une application qui doit permettre de gérer des catalogues et des produits, choses simples en soit.
Donc pour mon sujet j'ai choisi de partir sur une application Maven en modules.
Voici mes modules:
Dans mon module service j'ai une classe:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 pattern-design (parent) | |__api (Spring boot) | |__dao (Spring avec spring data mongoDB) | |__model | |__service (Spring)
CatalogService.java
Et dans mon module Api la classe:
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 package fr.epsi.pattern.design.service; import fr.epsi.pattern.design.dao.impl.CatalogDaoImpl; import fr.epsi.pattern.design.model.Catalog; import fr.epsi.pattern.design.service.mapper.CatalogMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Collection; @Service public class CatalogService { @Autowired private CatalogDaoImpl catalogDao; @Autowired private CatalogMapper catalogMapper; public void create(Catalog catalog){ catalogDao.create(catalogMapper.convertModelToPojo(catalog)); } public Catalog getCatalog(String label){ return catalogMapper.convertPojoToModel(catalogDao.findByLabel(label)); } public void delete(String label){ catalogDao.delete(label); } public void update(String label, Catalog catalog){ catalogDao.update(label, catalogMapper.convertModelToPojo(catalog)); } public Collection<Catalog> getCatalogs(){ return catalogMapper.convertPojoListToModelList(catalogDao.findAll()); } }
CatalogRestController.java
Voici le pom.xml du module API:
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 package fr.epsi.pattern.design.api.web.catalog.v1; import fr.epsi.pattern.design.model.Catalog; import fr.epsi.pattern.design.service.CatalogService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.util.ObjectUtils; import org.springframework.web.bind.annotation.*; import java.util.Collection; @RestController @RequestMapping(value = "/api/v1/catalog") public class CatalogRestController { @Autowired private CatalogService catalogService; @PostMapping public ResponseEntity create(@RequestBody Catalog catalog){ if(ObjectUtils.isEmpty(catalog)){ return new ResponseEntity(HttpStatus.BAD_REQUEST); } catalogService.create(catalog); return new ResponseEntity(HttpStatus.OK); } @GetMapping(value = "/{label}") public ResponseEntity<Catalog> getCatalog(@RequestParam("label") String label){ if(StringUtils.isBlank(label)){ return new ResponseEntity<Catalog>(HttpStatus.BAD_REQUEST); } return new ResponseEntity<Catalog>(catalogService.getCatalog(label), HttpStatus.OK); } @GetMapping public ResponseEntity<Collection<Catalog>> getCatalogs(){ return new ResponseEntity<Collection<Catalog>>(catalogService.getCatalogs(), HttpStatus.OK); } @PutMapping(value = "/{label}") public ResponseEntity update(@RequestParam("label") String label, @RequestBody Catalog catalog){ if(StringUtils.isBlank(label) || ObjectUtils.isEmpty(catalog)){ return new ResponseEntity(HttpStatus.BAD_REQUEST); } catalogService.update(label, catalog); return new ResponseEntity(HttpStatus.OK); } @DeleteMapping(value = "/{label}") public ResponseEntity delete(@RequestParam("label") String label){ if(StringUtils.isBlank(label)){ return new ResponseEntity(HttpStatus.BAD_REQUEST); } catalogService.delete(label); return new ResponseEntity(HttpStatus.OK); } }
et le pom.xml du module service:
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 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>api</artifactId> <packaging>jar</packaging> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.2.RELEASE</version> </parent> <dependencies> <dependency> <groupId>fr.epsi</groupId> <artifactId>service</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.5</version> </dependency> </dependencies> <properties> <java.version>1.8</java.version> </properties> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> <repositories> <repository> <id>spring-releases</id> <url>https://repo.spring.io/libs-release</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-releases</id> <url>https://repo.spring.io/libs-release</url> </pluginRepository> </pluginRepositories> </project>
Donc pour tester mon code avec POSTMAN je run mon spring boot et voici ce que j'obtient dans la console:
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 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> <artifactId>pattern-design</artifactId> <groupId>fr.epsi</groupId> <version>1.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>service</artifactId> <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>4.3.7.RELEASE</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>4.3.7.RELEASE</version> </dependency> <dependency> <groupId>fr.epsi</groupId> <artifactId>model</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> <dependency> <groupId>fr.epsi</groupId> <artifactId>dao</artifactId> <version>1.0.0-SNAPSHOT</version> </dependency> </dependencies> </project>
Après moultes recherches je ne parviens pas à comprendre pourquoi je ne peux pas faire de @Autowired sur mon bean CatalogService qui est pourtant bien annoté avec @Service alors que sur d'autre projets que j'ai fait cela fonctionne ...2017-05-14 14:19:22.328 WARN 1984 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'catalogRestController': Unsatisfied dependency expressed through field 'catalogService'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'fr.epsi.pattern.design.service.CatalogService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2017-05-14 14:19:22.328 INFO 1984 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2017-05-14 14:19:22.344 INFO 1984 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-05-14 14:19:22.406 ERROR 1984 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field catalogService in fr.epsi.pattern.design.api.web.catalog.v1.CatalogRestController required a bean of type 'fr.epsi.pattern.design.service.CatalogService' that could not be found.
Action:
Consider defining a bean of type 'fr.epsi.pattern.design.service.CatalogService' in your configuration.
Process finished with exit code 1
Auriez-vous une idée sur mon problème ?
Merci d'avance.
Bad_Pop
EDIT:
Voici le application-context-api.xml de mon module api:
EDIT2:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:component-scan base-package="fr.epsi.pattern.design"/> </beans>
Je viens d'ajouter cette ligne à mon Application.java car mon component scan ne semblait pas fonctionner:
et voici ce que j'obtient maintenant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part @SpringBootApplication(scanBasePackages = "fr.epsi.pattern.design")
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 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'catalogRestController': Unsatisfied dependency expressed through field 'catalogService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'catalogService': Unsatisfied dependency expressed through field 'catalogDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'catalogDaoImpl' defined in file [Z:\dev\cours\pattern-design\dao\target\classes\fr\epsi\pattern\design\dao\impl\CatalogDaoImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.epsi.pattern.design.dao.impl.CatalogDaoImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: fr.epsi.pattern.design.dao.config.MongoConfig$$EnhancerBySpringCGLIB$$cf3dd865 cannot be cast to org.springframework.data.mongodb.core.MongoOperations at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE] at fr.epsi.pattern.design.api.Application.main(Application.java:12) [classes/:na] Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'catalogService': Unsatisfied dependency expressed through field 'catalogDao'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'catalogDaoImpl' defined in file [Z:\dev\cours\pattern-design\dao\target\classes\fr\epsi\pattern\design\dao\impl\CatalogDaoImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.epsi.pattern.design.dao.impl.CatalogDaoImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: fr.epsi.pattern.design.dao.config.MongoConfig$$EnhancerBySpringCGLIB$$cf3dd865 cannot be cast to org.springframework.data.mongodb.core.MongoOperations at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:588) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] ... 19 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'catalogDaoImpl' defined in file [Z:\dev\cours\pattern-design\dao\target\classes\fr\epsi\pattern\design\dao\impl\CatalogDaoImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.epsi.pattern.design.dao.impl.CatalogDaoImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: fr.epsi.pattern.design.dao.config.MongoConfig$$EnhancerBySpringCGLIB$$cf3dd865 cannot be cast to org.springframework.data.mongodb.core.MongoOperations at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1155) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:208) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] ... 32 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [fr.epsi.pattern.design.dao.impl.CatalogDaoImpl]: Constructor threw exception; nested exception is java.lang.ClassCastException: fr.epsi.pattern.design.dao.config.MongoConfig$$EnhancerBySpringCGLIB$$cf3dd865 cannot be cast to org.springframework.data.mongodb.core.MongoOperations at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1147) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] ... 43 common frames omitted Caused by: java.lang.ClassCastException: fr.epsi.pattern.design.dao.config.MongoConfig$$EnhancerBySpringCGLIB$$cf3dd865 cannot be cast to org.springframework.data.mongodb.core.MongoOperations at fr.epsi.pattern.design.dao.impl.CatalogDaoImpl.<init>(CatalogDaoImpl.java:19) ~[classes/:na] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_101] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_101] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_101] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_101] at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142) ~[spring-beans-4.3.7.RELEASE.jar:4.3.7.RELEASE] ... 45 common frames omitted Process finished with exit code 1
Partager