I'm pretty much stucked and I hope you guys can help me out. Somehow I can't manage to get my spring context initialized.
I have these nice Bean Configuration classes:
@Configuration
public class CoreConfig {
@Bean
public TeamService createService(TeamPersistenceService teamPersistenceService) {
return new TeamEventHandler(teamPersistenceService);
}
}
And this one:
@Configuration
@EnableJpaRepositories(basePackages = "de.ktv.persistence.repository", //
includeFilters = @ComponentScan.Filter(value = { TeamsRepository.class }, type = FilterType.ASSIGNABLE_TYPE))
@EnableTransactionManagement
public class PersistenceConfig {
@Bean
public TeamPersistenceService createService(TeamsRepository repository) {
return new TeamPersistenceEventHandler(repository);
}
}
And in this test I want to use them:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { CoreConfig.class, PersistenceConfig.class })
public class CoreIntegrationTest {
@Autowired
TeamService teamService;
@Test
public void addNewTeamToTheSystem() {
//some test
}
The PersistenceConfig.class I am using in a different test and it works fine. But somehow here combined with CoreConfig.class it fails to initialize.
That is the error I get:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [de.ktv.core.services.TeamService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
I would really appreciate any help/hint.Thanks!