Ошибка создания bean-компонента с именем «catalogDaoService». Неудовлетворенная зависимость, выраженная через параметр кJAVA

Программисты JAVA общаются здесь
Ответить Пред. темаСлед. тема
Anonymous
 Ошибка создания bean-компонента с именем «catalogDaoService». Неудовлетворенная зависимость, выраженная через параметр к

Сообщение Anonymous »

Сообщение об ошибке:

Код: Выделить всё

java.lang.IllegalStateException:  Failed to load ApplicationContext for [WebMergedContextConfiguration@6da648c5 testClass = ru.sbrf.llt.autotests.testing.service.T5196Test, locations = [], classes = [ru.sbrf.llt.autotest.Application], contextInitializerClasses = [], activeProfiles = [], propertySourceLocations = [], propertySourceProperties = ["org.springframework.boot.test.context.SpringBootTestContextBootstrapper=true"], contextCustomizers = [org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@63e5b8aa, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@3f6cce7f, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.web.client.TestRestTemplateContextCustomizer@2407a36c, org.springframework.boot.test.autoconfigure.actuate.observability.ObservabilityContextCustomizerFactory$DisableObservabilityContextCustomizer@1f, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@0, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@44dfdd58, org.springframework.boot.test.context.SpringBootTestAnnotation@f590c3b4], resourceBasePath = "src/main/webapp", contextLoader = org.springframework.boot.test.context.SpringBootContextLoader,  p a r e n t   =   n u l l ] < b r   / > < b r   / >         a t   o r g . s p r i n g f r a m e w o r k . t e s t . c o n t e x t . c a c h e . D e f a u l t C a c h e A w a r e C o n t e x t L o a d e r D e l e g a t e . l o a d C o n t e x t ( D e f a u l t C a c h e A w a r e C o n t e x t L o a d e r D e l e g a t e . j a v a : 1 4 2 ) < b r   / >         a t   o r g . s p r i n g f r a m e w o r k . t e s t . c o n t e x t . s u p p o r t . D e f a u l t T e s t C o n t e x t . g e t A p p l i c a t i o n C o n t e x t ( D e f a u l t T e s t C o n t e x t . j a v a : 1 2 7 ) < b r   / >         a t   o r g . s p r i n g f r a m e w o r k . t e s t . c o n t e x t . w e b . S e r v l e t T e s t E x e c u t i o n L i s t e n e r . s e t U p R e q u e s t C o n t e x t I f N e c e s s a r y ( S e r v l e t T e s t E x e c u t i o n L i s t e n e r . j a v a : 1 9 1 ) < b r   / >         a t   o r g . s p r i n g f r a m e w o r k . t e s t . c o n t e x t . w e b . S e r v l e t T e s t E x e c u t i o n L i s t e n e r . p r e p a r e T e s t I n s t a n c e ( S e r v l e t T e s t E x e c u t i o n L i s t e n e r . j a v a : 1 3 0 ) < b r   / >         a t   o r g . s p r i n g f r a m e w o r k . t e s t . c o n t e x t . T e s t C o n t e x t M a n a g e r . p r e p a r e T e s t I n s t a n c e ( T e s t C o n t e x t M a n a g e r . j a v a : 2 4 1 ) < b r   / >         a t   o r g . s p r i n g f r a m e w o r k . t e s t . c o n t e x t . j u n i t . j u p i t e r . S p r i n g E x t e n s i o n . p o s t P r o c e s s T e s t I n s t a n c e ( S p r i n g E x t e n s i o n . j a v a : 1 3 8 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . l a m b d a $ i n v o k e T e s t I n s t a n c e P o s t P r o c e s s o r s $ 1 0 ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 3 7 7 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . e x e c u t e A n d M a s k T h r o w a b l e ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 3 8 2 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . l a m b d a $ i n v o k e T e s t I n s t a n c e P o s t P r o c e s s o r s $ 1 1 ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 3 7 7 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . R e f e r e n c e P i p e l i n e $ 3 $ 1 . a c c e p t ( R e f e r e n c e P i p e l i n e . j a v a : 1 9 7 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . R e f e r e n c e P i p e l i n e $ 2 $ 1 . a c c e p t ( R e f e r e n c e P i p e l i n e . j a v a : 1 7 9 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . A r r a y L i s t $ A r r a y L i s t S p l i t e r a t o r . f o r E a c h R e m a i n i n g ( A r r a y L i s t . j a v a : 1 6 2 5 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . A b s t r a c t P i p e l i n e . c o p y I n t o ( A b s t r a c t P i p e l i n e . j a v a : 5 0 9 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . A b s t r a c t P i p e l i n e . w r a p A n d C o p y I n t o ( A b s t r a c t P i p e l i n e . j a v a : 4 9 9 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . S t r e a m S p l i t e r a t o r s $ W r a p p i n g S p l i t e r a t o r . f o r E a c h R e m a i n i n g ( S t r e a m S p l i t e r a t o r s . j a v a : 3 1 0 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . S t r e a m s $ C o n c a t S p l i t e r a t o r . f o r E a c h R e m a i n i n g ( S t r e a m s . j a v a : 7 3 5 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . S t r e a m s $ C o n c a t S p l i t e r a t o r . f o r E a c h R e m a i n i n g ( S t r e a m s . j a v a : 7 3 4 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . s t r e a m . R e f e r e n c e P i p e l i n e $ H e a d . f o r E a c h ( R e f e r e n c e P i p e l i n e . j a v a : 7 6 2 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . i n v o k e T e s t I n s t a n c e P o s t P r o c e s s o r s ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 3 7 6 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . l a m b d a $ i n s t a n t i a t e A n d P o s t P r o c e s s T e s t I n s t a n c e $ 6 ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 2 8 9 ) < b r   / >         a t   o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 7 3 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . i n s t a n t i a t e A n d P o s t P r o c e s s T e s t I n s t a n c e ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 2 8 8 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . l a m b d a $ t e s t I n s t a n c e s P r o v i d e r $ 4 ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 2 7 8 ) < b r   / >         a t   j a v a . b a s e / j a v a . u t i l . O p t i o n a l . o r E l s e G e t ( O p t i o n a l . j a v a : 3 6 4 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . C l a s s B a s e d T e s t D e s c r i p t o r . l a m b d a $ t e s t I n s t a n c e s P r o v i d e r $ 5 ( C l a s s B a s e d T e s t D e s c r i p t o r . j a v a : 2 7 7 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . e x e c u t i o n . T e s t I n s t a n c e s P r o v i d e r . g e t T e s t I n s t a n c e s ( T e s t I n s t a n c e s P r o v i d e r . j a v a : 3 1 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . T e s t M e t h o d T e s t D e s c r i p t o r . l a m b d a $ p r e p a r e $ 0 ( T e s t M e t h o d T e s t D e s c r i p t o r . j a v a : 1 0 5 ) < b r   / >         a t   o r g . j u n i t . p l a t f o r m . e n g i n e . s u p p o r t . h i e r a r c h i c a l . T h r o w a b l e C o l l e c t o r . e x e c u t e ( T h r o w a b l e C o l l e c t o r . j a v a : 7 3 ) < b r   / >         a t   o r g . j u n i t . j u p i t e r . e n g i n e . d e s c r i p t o r . T e s t M e t h o d T e s t D e s c riptor.prepare(TestMethodTestDescriptor.java:104)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.prepare(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$prepare$2(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.prepare(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:90)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:53)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:71)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by:  org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'catalogDaoService' defined in file [C:\Work\catalog-autotest-new\target\classes\ru\sbrf\llt\autotest\service\dao\CatalogDaoService.class]: Unsatisfied dependency expressed through constructor parameter 0: Error creating bean with name 'cardRepository' defined in ru.sbrf.llt.autotest.service.repository.CardRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: org/springframework/data/jpa/repository/support/SimpleJpaRepository$AjcClosure79
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:245)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1352)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:560)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:973)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:941)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:608)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:733)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:435)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
at org.springframework.boot.test.context.SpringBootContextLoader.lambda$loadContext$3(SpringBootContextLoader.java:137)
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:58)
at org.springframework.util.function.ThrowingSupplier.get(ThrowingSupplier.java:46)
at org.springframework.boot.SpringApplication.withHook(SpringApplication.java:1405)
at org.springframework.boot.test.context.SpringBootContextLoader$ContextLoaderHook.run(SpringBootContextLoader.java:545)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:137)
at org.springframework.boot.test.context.SpringBootContextLoader.loadContext(SpringBootContextLoader.java:108)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:184)
at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:118)
...  72 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cardRepository' defined in ru.sbrf.llt.autotest.service.repository.CardRepository defined in @EnableJpaRepositories declared on JpaRepositoriesRegistrar.EnableJpaRepositoriesConfiguration: org/springframework/data/jpa/repository/support/SimpleJpaRepository$AjcClosure79
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:598)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:520)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:326)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:254)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1417)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1337)
at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:888)
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
... 96 more
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/jpa/repository/support/SimpleJpaRepository$AjcClosure79
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3373)
at java.base/java.lang.Class.getDeclaredConstructors(Class.java:2555)
at org.springframework.data.util.ReflectionUtils.findConstructor(ReflectionUtils.java:258)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.instantiateClass(RepositoryFactorySupport.java:569)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getTargetRepositoryViaReflection(RepositoryFactorySupport.java:536)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:212)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:194)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactory.getTargetRepository(JpaRepositoryFactory.java:81)
at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:317)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:279)
at org.springframework.data.util.Lazy.getNullable(Lazy.java:245)
at org.springframework.data.util.Lazy.get(Lazy.java:114)
at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:285)
at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:132)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1816)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1766)
... 107 more
Caused by: java.lang.ClassNotFoundException: org.springframework.data.jpa.repository.support.SimpleJpaRepository$AjcClosure79
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
...  124 more
Мой каталогDaoService.java:

Код: Выделить всё

@Getter
@RequiredArgsConstructor
@Component
public class CatalogDaoService {

private final CardRepository cardRepository;
}
CardRepository.java

Код: Выделить всё

@Repository
public interface CardRepository extends JpaRepository{

@Query("select card from Card card where card.dpan in (:pans)")
List getCardsByPans(List pans);
}
Card.java

Код: Выделить всё

@Getter
@Setter
@Entity
@Table(name = "CARD")
@NoArgsConstructor
@ToString
@DynamicInsert
public class Card extends AbstractCard {

@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "s_card")
@SequenceGenerator(
name = "s_card",
sequenceName = "s_card",
allocationSize = 100
)
private Long id;

@Column(name = "id_card_line", updatable = false)
private Long idCardLine;

@Column(name = "event_time")
private ZonedDateTime eventTime;

@OneToMany(mappedBy = "card", fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@Fetch(FetchMode.JOIN)
private Set tokenInfoList = new HashSet();
}

Также я создал класс конфигурации для JPA:

Код: Выделить всё

@Configuration
@EnableJpaRepositories(
basePackages = "ru.sbrf.llt.autotest.service.repository",
entityManagerFactoryRef = "catalogEntityManager",
transactionManagerRef = "catalogTransactionManager"
)
public class CatalogStorageConfiguration {

@Value("${spring.datasource.dialect}")
private String dialect;

@Value("${spring.datasource.hbm2ddl}")
private String hbm2ddl;

@Bean
@ConfigurationProperties("spring.datasource")
public DataSource catalogDatasourceProp() {
return DataSourceBuilder.create().build();
}

@Bean(name = "catalogTemplate")
public JdbcTemplate catalogJdbcTemplate(@Qualifier("catalogDatasourceProp") DataSource ds) {
return new JdbcTemplate(ds);
}

@Bean
public LocalContainerEntityManagerFactoryBean catalogEntityManager(
@Qualifier("catalogDatasourceProp") DataSource dataSource
) throws Exception {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource);
em.setPackagesToScan("ru.sbrf.llt.autotest.service.repository");

HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
HashMap properties = new HashMap();
properties.put("hibernate.dialect", dialect);
properties.put("hibernate.default_schema", dataSource.getConnection().getSchema());
properties.put("hibernate.hbm2ddl.auto", hbm2ddl);
em.setJpaPropertyMap(properties);

return em;
}

@Bean
public PlatformTransactionManager catalogTransactionManager(
@Qualifier("catalogEntityManager") LocalContainerEntityManagerFactoryBean managerFactoryBean
) {
JpaTransactionManager transactionManager = new JpaTransactionManager();
transactionManager.setEntityManagerFactory(managerFactoryBean.getObject());
return transactionManager;
}
}
И когда я запускаю свой тестовый класс, я сталкиваюсь с вышеуказанной ошибкой

Код: Выделить всё

public class T5196Test extends TestBase {

@Test
void testAcceptEvents() throws Exception {
String jsonString = new String(Files.readAllBytes(Path.of("src/test/resources/files/T5196.json")));
Empty response = sendEvent(jsonString);
Assertions.assertEquals(Empty.getDefaultInstance(), response);

long count = catalogDaoService.getCardRepository().count();
Assertions.assertEquals(2, count);

}
}
Помогите, пожалуйста!
Ошибка UnsatisfiedDependencyException указывает на то, что Spring не может создать bean-компонент CatalogDaoService, поскольку он не может создать bean-компонент CardRepository. Это может быть вызвано несколькими проблемами, включая неправильную конфигурацию Spring Data JPA или отсутствие зависимостей. Я проверил все свои курсы и так и не понял.

Подробнее здесь: https://stackoverflow.com/questions/790 ... ncy-expres
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «JAVA»