Bonjour,

Mon application Spring boot ne veut plus se lancer.
Las stack trace suggère qu'il ne trouve pas mes objets métiers.
Ils sont dans un autre projet, du workspace qui est référencé par maven.

L'erreur se propage du controller ver le service et le repository.
L'erreur semble être que mes objets métier ne soient pas reconnus.

Pourtant j'ai bien mis le package dans l'annotation scanBasePackages={ dans ma classe de base.
Stack trace ci-dessous et code de la classe principale

Je lance mon application en faisant "run application" ou "run spring "application sur la racine du projet ou la classe principale.

Il me semblait que Spring boot se débrouillait tout seul en ajoutant toutes les classes annotées avec les anotations annotations Spring.

Je me demande aussi si une partie de la configuration automatique faite avec le wizard à peut être sautée.

Mes derniers changements ont été d'ajouter une classe métier, et son controller et son dervice.

Si vous avez une idée ?

Cordialement


...

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-04-12 13:08:38.746 ERROR 13132 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'compteController': Unsatisfied dependency expressed through field 'compteRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compteRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class fr.xcomptacore.base.Compte
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:627) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:385) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1417) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:870) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877) ~[spring-context-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) ~[spring-context-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:748) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1227) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1216) ~[spring-boot-2.2.0.M4.jar:2.2.0.M4]
at fr.xcompta.XComptaSpringBootApplication.main(XComptaSpringBootApplication.java:19) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) ~[spring-boot-devtools-2.2.0.M4.jar:2.2.0.M4]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compteRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Not a managed type: class fr.xcomptacore.base.Compte
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1791) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1276) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1196) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:624) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
... 24 common frames omitted
Caused by: java.lang.IllegalArgumentException: Not a managed type: class fr.xcomptacore.base.Compte
at org.hibernate.metamodel.internal.MetamodelImpl.managedType(MetamodelImpl.java:582) ~[hibernate-core-5.4.3.Final.jar:5.4.3.Final]
at org.hibernate.metamodel.internal.MetamodelImpl.managedType(MetamodelImpl.java:85) ~[hibernate-core-5.4.3.Final.jar:5.4.3.Final]
at org.springframework.data.jpa.repository.support.JpaMetamodelEntityInformation.<init>(JpaMetamodelEntityInformation.java:74) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.jpa.repository.support.JpaEntityInformationSupport.getEntityInformation(JpaEntityInformationSupport.java:66) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getEntityInformation(JpaRepositoryFactory.java:201) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:151) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:134) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:65) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:302) ~[spring-data-commons-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297) ~[spring-data-commons-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.util.Lazy.getNullable(Lazy.java:211) ~[spring-data-commons-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.util.Lazy.get(Lazy.java:94) ~[spring-data-commons-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300) ~[spring-data-commons-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121) ~[spring-data-jpa-2.2.0.RC1.jar:2.2.0.RC1]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1850) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1787) ~[spring-beans-5.2.0.M3.jar:5.2.0.M3]
... 34 common frames omitted
Code classe principale
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
@SpringBootApplication(
		scanBasePackages={
				"fr.xcomptacore.base, " +
 
				"fr.xcompta.configuration, " +
		"fr.xcompta.controller, " +
						"fr.xcompta.repository, " +
		"fr.xcompta.service"
						})
//exclude = { DataSourceAutoConfiguration.class }, )
public class XComptaSpringBootApplication {
 
	public static void main(String[] args) {
		SpringApplication.run(XComptaSpringBootApplication.class, args);
	}
 
}