Skip to content

Commit

Permalink
DATAGRAPH-894 - Fixed tests that loaded too much through @componentscan.
Browse files Browse the repository at this point in the history
  • Loading branch information
mangrish committed Aug 3, 2016
1 parent 7c3a8e8 commit 564d592
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 20 deletions.
Expand Up @@ -56,7 +56,7 @@ public abstract class Neo4jConfiguration {

@Bean
public Session getSession() throws Exception {
logger.info("Initialising Neo4jSession");
logger.debug("Initialising Neo4jSession");
SessionFactory sessionFactory = getSessionFactory();
Assert.notNull(sessionFactory, "You must provide a SessionFactory instance in your Spring configuration classes");
return sessionFactory.openSession();
Expand Down
Expand Up @@ -18,6 +18,7 @@
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.neo4j.examples.friends.FriendService;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

Expand All @@ -26,7 +27,7 @@
*/
@Configuration
@EnableNeo4jRepositories("org.springframework.data.neo4j.examples.friends.repo")
@ComponentScan({"org.springframework.data.neo4j.examples.friends"})
@ComponentScan(basePackageClasses = FriendService.class)
@EnableTransactionManagement
public class FriendContext extends Neo4jConfiguration {

Expand Down
Expand Up @@ -26,7 +26,7 @@
* @author Vince Bickers
*/
@Configuration
@ComponentScan({"org.springframework.data.neo4j.examples.galaxy.*"})
@ComponentScan({"org.springframework.data.neo4j.examples.galaxy.service"})
@PropertySource("classpath:helloworld.properties")
@EnableNeo4jRepositories("org.springframework.data.neo4j.examples.galaxy.repo")
@EnableTransactionManagement
Expand Down
Expand Up @@ -17,14 +17,16 @@
import org.neo4j.ogm.session.SessionFactory;
import org.springframework.context.annotation.*;
import org.springframework.data.neo4j.config.Neo4jConfiguration;
import org.springframework.data.neo4j.examples.jsr303.controller.AdultController;
import org.springframework.data.neo4j.examples.jsr303.service.AdultService;
import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
* @author Vince Bickers
*/
@Configuration
@ComponentScan
@ComponentScan(basePackageClasses = { AdultService.class })
@EnableNeo4jRepositories("org.springframework.data.neo4j.examples.jsr303.repo")
@EnableTransactionManagement
public class JSR303Context extends Neo4jConfiguration {
Expand Down
Expand Up @@ -26,7 +26,7 @@
* @author Michal Bachman
*/
@Configuration
@ComponentScan({"org.springframework.data.neo4j.examples.movies"})
@ComponentScan({"org.springframework.data.neo4j.examples.movies.service"})
@EnableNeo4jRepositories("org.springframework.data.neo4j.examples.movies.repo")
@EnableTransactionManagement
public class MoviesContext extends Neo4jConfiguration {
Expand Down
Expand Up @@ -28,7 +28,7 @@
* @author Adam George
*/
@Configuration
@EnableNeo4jRepositories
@EnableNeo4jRepositories(basePackageClasses = {SiteMemberRepository.class, PensionRepository.class, JavaElementRepository.class})
@EnableTransactionManagement
public class ConversionServicePersistenceContext extends Neo4jConfiguration {

Expand Down
Expand Up @@ -25,7 +25,6 @@
* @author Michal Bachman
*/
@Configuration
@ComponentScan({"org.springframework.data.neo4j.repositories"})
@EnableNeo4jRepositories("org.springframework.data.neo4j.repositories.repo")
@EnableTransactionManagement
public class RepositoriesTestContext extends Neo4jConfiguration {
Expand Down
Expand Up @@ -12,10 +12,7 @@
* @author vince
*/
@Configuration
@ComponentScan(basePackages = "org.springframework.data.neo4j.transactions",
excludeFilters =@ComponentScan.Filter(
type = FilterType.REGEX,
pattern = "org\\.springframework\\.data\\.neo4j\\.transactions\\.TransactionalEventListenerTests.*"))
@ComponentScan(basePackages = "org.springframework.data.neo4j.transactions.service")
@EnableTransactionManagement
@EnableNeo4jRepositories
public class PrototypeSessionBeanContext extends Neo4jConfiguration {
Expand Down
Expand Up @@ -12,10 +12,7 @@
* @author vince
*/
@Configuration
@ComponentScan(basePackages = "org.springframework.data.neo4j.transactions",
excludeFilters =@ComponentScan.Filter(
type = FilterType.REGEX,
pattern = "org\\.springframework\\.data\\.neo4j\\.transactions\\.TransactionalEventListenerTests.*"))
@ComponentScan(basePackages = "org.springframework.data.neo4j.transactions.service")
@EnableTransactionManagement
@EnableNeo4jRepositories
public class ProxiedPrototypeSessionBeanContext extends Neo4jConfiguration {
Expand Down
Expand Up @@ -13,10 +13,7 @@
* @author vince
*/
@Configuration
@ComponentScan(basePackages = "org.springframework.data.neo4j.transactions",
excludeFilters =@ComponentScan.Filter(
type = FilterType.REGEX,
pattern = "org\\.springframework\\.data\\.neo4j\\.transactions\\.TransactionalEventListenerTests.*"))
@ComponentScan(basePackages = "org.springframework.data.neo4j.transactions.service")
@EnableTransactionManagement
@EnableNeo4jRepositories
public class ThreadScopeSessionBeanContext extends Neo4jConfiguration {
Expand Down
Expand Up @@ -31,7 +31,7 @@
*/
@Configuration
@EnableWebMvc
@ComponentScan({"org.springframework.data.neo4j.web"})
@ComponentScan({"org.springframework.data.neo4j.web.controller", "org.springframework.data.neo4j.web.service"})
@EnableExperimentalNeo4jRepositories("org.springframework.data.neo4j.web.repo")
@EnableTransactionManagement
public class WebAppContext extends WebMvcConfigurerAdapter {
Expand Down

0 comments on commit 564d592

Please sign in to comment.