/*CustomerRepository4Tests.java */
package com.springsource.data.sample.domain;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.util.Date;
import java.util.List;
import javax.sql.DataSource;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
public class CustomerRepository4Tests {
@Autowired
private CustomerRepository customerRepository;
@Autowired
private DataSource dataSource;
@Before
public void onSetUpInTransaction() throws Exception {
// Load test data
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.execute("delete from customer");
jdbcTemplate.execute(
"insert into customer (id, customer_number, name, birth_date) " +
"values (1, 'Z.12345.67890', 'Bubba', '1990-02-03')");
jdbcTemplate.execute(
"insert into customer (id, customer_number, name, birth_date) " +
"values (2, 'Z.12345.98765', 'Mary', '1988-01-31')");
}
@Transactional @Test
public void testFindAll() {
List l = customerRepository.findAll();
assertEquals("Wrong number of customers returned", 2, l.size());
}
@Transactional @Test
public void testFindById() {
Customer c = customerRepository.findById(2L);
assertNotNull("Customer not found", c);
}
@Transactional @Test
public void testAddCustomer() {
Customer c = new Customer();
c.setBirthDate(new Date(104400000L));
c.setName("Sven");
customerRepository.add(c);
assertNotNull("Customer id not assigned", c.getId());
assertTrue("Bad customer id", 3 <= c.getId());
assertNotNull("Customer number not assigned", c.getCustomerNumber());
}
@Transactional @Test
public void testUpdateCustomer() {
Customer c = customerRepository.findById(2L);
c.setBirthDate(new Date(18000000L));
customerRepository.save(c);
Customer c2 = customerRepository.findById(2L);
assertEquals("BirthDate not updated", 18000000L, c2.getBirthDate().getTime());
}
}
==========
/* produces these errors... should i take autowire off? again just trying to run the example found here: http://www.google.com/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fen.oreilly.com%2Foscon2008%2Fpublic%2Fschedule%2Fdetail%2F2629&ei=jJcXSYzbHZmMsQPOkriHCw&usg=AFQjCNEM5AZ0t_MbFfiOByeueEj1X3kskw&sig2=o7VqrkFiuL8zxtRG90uOsg */
-====
18:03:35,493 DEBUG SpringJUnit4ClassRunner:78 - SpringJUnit4ClassRunner constructor called with [class com.springsource.data.sample.domain.CustomerRepository4Tests].
18:03:35,522 INFO TestContextManager:167 - @TestExecutionListeners is not present for class [class com.springsource.data.sample.domain.CustomerRepository4Tests]: using defaults.
18:03:35,554 DEBUG SpringJUnit4ClassRunner:139 - Invoking test method [public void com.springsource.data.sample.domain.CustomerRepository4Tests.testFindAll()]
18:03:35,559 DEBUG DependencyInjectionTestExecutionListener:73 - Performing dependency injection for test context [[TestContext@25d2b2 testClass = CustomerRepository4Tests, locations = array['classpath:/com/springsource/data/sample/domain/CustomerRepository4Tests-context.xml'], testInstance = com.springsource.data.sample.domain.CustomerRepository4Tests@12be1bd, testMethod = [null], testException = [null]]].
18:03:35,559 DEBUG AbstractGenericContextLoader:75 - Loading ApplicationContext for locations [classpath:/com/springsource/data/sample/domain/CustomerRepository4Tests-context.xml].
18:03:35,626 INFO XmlBeanDefinitionReader:323 - Loading XML bean definitions from class path resource [com/springsource/data/sample/domain/CustomerRepository4Tests-context.xml]
18:03:35,648 DEBUG DefaultDocumentLoader:72 - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
18:03:35,695 DEBUG PluggableSchemaResolver:125 - Loading schema mappings from [META-INF/spring.schemas]
18:03:35,705 DEBUG PluggableSchemaResolver:131 - Loaded schema mappings: {http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd}
18:03:35,706 DEBUG PluggableSchemaResolver:114 - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd
18:03:35,765 DEBUG PluggableSchemaResolver:114 - Found XML schema [http://www.springframework.org/schema/context/spring-context-2.5.xsd] in classpath: org/springframework/context/config/spring-context-2.5.xsd
18:03:35,786 DEBUG PluggableSchemaResolver:114 - Found XML schema [http://www.springframework.org/schema/tx/spring-tx-2.5.xsd] in classpath: org/springframework/transaction/config/spring-tx-2.5.xsd
18:03:35,802 DEBUG DefaultBeanDefinitionDocumentReader:86 - Loading bean definitions
18:03:35,816 DEBUG DefaultNamespaceHandlerResolver:153 - Loaded mappings [{http://www.springframework.org/schema/p=org.springframework.beans.factory.xml.SimplePropertyNamespaceHandler, http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler, http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler, http://www.springframework.org/schema/aop=org.springframework.aop.config.AopNamespaceHandler, http://www.springframework.org/schema/util=org.springframework.beans.factory.xml.UtilNamespaceHandler, http://www.springframework.org/schema/jms=org.springframework.jms.config.JmsNamespaceHandler, http://www.springframework.org/schema/tx=org.springframework.transaction.config.TxNamespaceHandler, http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler}]
18:03:35,856 DEBUG PathMatchingResourcePatternResolver:541 - Looking for matching resources in directory tree [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample]
18:03:35,857 DEBUG PathMatchingResourcePatternResolver:586 - Searching directory [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample] for files matching pattern [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/**/*.class]
18:03:35,858 DEBUG PathMatchingResourcePatternResolver:586 - Searching directory [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/domain] for files matching pattern [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/**/*.class]
18:03:35,863 DEBUG PathMatchingResourcePatternResolver:346 - Resolved location pattern [classpath*:com/springsource/data/sample/**/*.class] to resources [file [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/domain/CustomerRepository.class], file [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/domain/SimpleCustomerRepository.class], file [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/domain/Customer.class], file [/home/chasetoys/workspace/springy-reloaded/bin/com/springsource/data/sample/domain/CustomerRepository4Tests.class]]
18:03:35,954 DEBUG XmlBeanDefinitionReader:185 - Loaded 10 bean definitions from location pattern [classpath:/com/springsource/data/sample/domain/CustomerRepository4Tests-context.xml]
18:03:35,959 INFO GenericApplicationContext:411 - Refreshing org.springframework.context.support.GenericApplicationContext@1016632: display name [org.springframework.context.support.GenericApplicationContext@1016632]; startup date [Sun Nov 09 18:03:35 PST 2008]; root of context hierarchy
18:03:35,959 INFO GenericApplicationContext:426 - Bean factory for application context [org.springframework.context.support.GenericApplicationContext@1016632]: org.springframework.beans.factory.support.DefaultListableBeanFactory@197bb7
18:03:35,960 DEBUG GenericApplicationContext:430 - 10 beans defined in org.springframework.context.support.GenericApplicationContext@1016632: display name [org.springframework.context.support.GenericApplicationContext@1016632]; startup date [Sun Nov 09 18:03:35 PST 2008]; root of context hierarchy
18:03:35,973 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0'
18:03:35,974 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0'
18:03:35,992 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0' to allow for resolving potential circular references
18:03:36,009 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0'
18:03:36,010 INFO PropertyPlaceholderConfigurer:178 - Loading properties file from class path resource [jdbc.properties]
18:03:36,015 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
18:03:36,015 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
18:03:36,025 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' to allow for resolving potential circular references
18:03:36,031 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
18:03:36,031 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
18:03:36,032 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
18:03:36,033 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' to allow for resolving potential circular references
18:03:36,037 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
18:03:36,038 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
18:03:36,038 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
18:03:36,039 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor' to allow for resolving potential circular references
18:03:36,048 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
18:03:36,049 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator'
18:03:36,050 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator'
18:03:36,062 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.aop.config.internalAutoProxyCreator' to allow for resolving potential circular references
18:03:36,072 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.aop.config.internalAutoProxyCreator'
18:03:36,085 DEBUG GenericApplicationContext:648 - Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@c943d1]
18:03:36,088 DEBUG GenericApplicationContext:672 - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@15e2ccd]
18:03:36,090 INFO DefaultListableBeanFactory:414 - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@197bb7: defining beans [org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager]; root of factory hierarchy
18:03:36,090 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor'
18:03:36,091 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor'
18:03:36,092 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.context.annotation.internalRequiredAnnotationProcessor'
18:03:36,092 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0'
18:03:36,093 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'dataSource'
18:03:36,093 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'dataSource'
18:03:36,101 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'dataSource' to allow for resolving potential circular references
18:03:36,106 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
18:03:36,106 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor'
18:03:36,108 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.transaction.config.internalTransactionAdvisor' to allow for resolving potential circular references
18:03:36,113 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
18:03:36,114 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
18:03:36,115 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' to allow for resolving potential circular references
18:03:36,120 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
18:03:36,121 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.transaction.config.internalTransactionAdvisor'
18:03:36,127 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'dataSource'
18:03:36,127 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.aop.config.internalAutoProxyCreator'
18:03:36,128 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
18:03:36,128 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0'
18:03:36,128 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0'
18:03:36,133 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0' to allow for resolving potential circular references
18:03:36,137 DEBUG DefaultListableBeanFactory:214 - Creating shared instance of singleton bean 'transactionManager'
18:03:36,137 DEBUG DefaultListableBeanFactory:383 - Creating instance of bean 'transactionManager'
18:03:36,144 DEBUG DefaultListableBeanFactory:459 - Eagerly caching bean 'transactionManager' to allow for resolving potential circular references
18:03:36,148 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'dataSource'
18:03:36,150 DEBUG DefaultListableBeanFactory:1367 - Invoking afterPropertiesSet() on bean with name 'transactionManager'
18:03:36,151 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
18:03:36,153 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'transactionManager'
18:03:36,153 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0'
18:03:36,154 DEBUG DefaultListableBeanFactory:1367 - Invoking afterPropertiesSet() on bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0'
18:03:36,154 DEBUG DefaultListableBeanFactory:411 - Finished creating instance of bean 'org.springframework.transaction.interceptor.TransactionInterceptor#0'
18:03:36,163 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'org.springframework.transaction.config.internalTransactionAdvisor'
18:03:36,163 DEBUG DefaultListableBeanFactory:214 - Returning cached instance of singleton bean 'transactionManager'
18:03:36,169 DEBUG InjectionMetadata:69 - Found injected field on class [com.springsource.data.sample.domain.CustomerRepository4Tests]: AutowiredFieldElement for private com.springsource.data.sample.domain.CustomerRepository com.springsource.data.sample.domain.CustomerRepository4Tests.customerRepository
18:03:36,171 DEBUG InjectionMetadata:69 - Found injected field on class [com.springsource.data.sample.domain.CustomerRepository4Tests]: AutowiredFieldElement for private javax.sql.DataSource com.springsource.data.sample.domain.CustomerRepository4Tests.dataSource
18:03:36,172 DEBUG InjectionMetadata:103 - Processing injected field of bean 'com.springsource.data.sample.domain.CustomerRepository4Tests': AutowiredFieldElement for private com.springsource.data.sample.domain.CustomerRepository com.springsource.data.sample.domain.CustomerRepository4Tests.customerRepository
18:03:36,175 ERROR TestContextManager:258 - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@1a6684f] to prepare test instance [com.springsource.data.sample.domain.CustomerRepository4Tests@12be1bd]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.springsource.data.sample.domain.CustomerRepository4Tests': Autowiring of fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.springsource.data.sample.domain.CustomerRepository com.springsource.data.sample.domain.CustomerRepository4Tests.customerRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.springsource.data.sample.domain.CustomerRepository] is defined: Unsatisfied dependency of type [interface com.springsource.data.sample.domain.CustomerRepository]: expected at least 1 matching bean
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:243)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:329)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)
at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:255)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:111)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:148)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:50)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.springsource.data.sample.domain.CustomerRepository com.springsource.data.sample.domain.CustomerRepository4Tests.customerRepository; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.springsource.data.sample.domain.CustomerRepository] is defined: Unsatisfied dependency of type [interface com.springsource.data.sample.domain.CustomerRepository]: expected at least 1 matching bean
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:435)
at org.springframework.beans.factory.annotation.InjectionMetadata.injectFields(InjectionMetadata.java:105)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessAfterInstantiation(AutowiredAnnotationBeanPostProcessor.java:240)
... 19 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [com.springsource.data.sample.domain.CustomerRepository] is defined: Unsatisfied dependency of type [interface com.springsource.data.sample.domain.CustomerRepository]: expected at least 1 matching bean
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:613)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:412)
... 21 more
java.lang.NoSuchMethodError: org.junit.runner.notification.RunNotifier.testAborted(Lorg/junit/runner/Description;Ljava/lang/Throwable;)V18:03:36,179 INFO GenericApplicationContext:815 - Closing org.springframework.context.support.GenericApplicationContext@1016632: display name [org.springframework.context.support.GenericApplicationContext@1016632]; startup date [Sun Nov 09 18:03:35 PST 2008]; root of context hierarchy
18:03:36,179 INFO DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@197bb7: defining beans [org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,dataSource,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager]; root of factory hierarchy
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:155)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:52)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:50)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:97)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
18:03:36,179 DEBUG DisposableBeanAdapter:203 - Invoking destroy method 'close' on bean with name 'dataSource'