i get a NoSuchBeanDefinitionException - "No bean named 'transactionManager' is defined" with my configuration.
My configuration is running in case of normal webapp start.
JUnit Class
#RunWith(SpringJUnit4ClassRunner.class)
#TestExecutionListeners({ TransactionalTestExecutionListener.class, DependencyInjectionTestExecutionListener.class })
#ContextConfiguration(locations = {"classpath:**/applicationContext.xml", "classpath:**/datasource-config.xml"}) //,
#TransactionConfiguration(defaultRollback = true)
#Transactional
public class TestTripService {
TripService tripService;
#Test
public void addTrip() {
.
.
.
application-context.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans .......
spring-context-3.0.xsd">
<import resource="datasource-config.xml" />
<import resource="webflow-config.xml" />
<import resource="security-config.xml" />
<context:annotation-config/>
<context:component-scan base-package="de.wiegand.mytransport" />
<!-- DAO declarations -->
<bean id="userDao" class="de.wiegand.mytransport.dao.UserJpaDao" />
<bean id="shippingAgencyDao" class="de.wiegand.mytransport.dao.ShippingAgencyJplDao" />
<!-- Services declarations -->
<bean id="userService" class="de.wiegand.mytransport.services.impl.UserServiceImpl">
<property name="userDao" ref="userDao" />
<property name="shippingAgencyDao" ref="shippingAgencyDao" />
</bean>
<bean id="userAuthenticationProviderService"
class="de.wiegand.mytransport.services.impl.UserAuthenticationProviderServiceImpl">
<property name="authenticationManager" ref="authenticationManager" />
</bean>
<bean id="tripService" class="de.wiegand.mytransport.services.impl.TripServiceImpl" />
<bean id="schedulerTask" class="org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean">
<property name="targetObject" ref="postCodeManager" />
<property name="targetMethod" value="init" />
</bean>
<bean id="postCodeManager" class="de.wiegand.mytransport.postcodeservice.PostCodeManager" />
<bean id="timerTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
<property name="timerTask" ref="schedulerTask" />
<property name="delay" value="1000" />
</bean>
<bean class="org.springframework.scheduling.timer.TimerFactoryBean">
<property name="scheduledTimerTasks">
<list>
<ref local="timerTask" />
</list>
</property>
</bean>
datasource-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<context:property-placeholder location="classpath:datasource.properties" />
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/test2" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="true" />
<property name="generateDdl" value="true" />
<property name="databasePlatform" value="org.hibernate.dialect.MySQL5Dialect" />
</bean>
</property>
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="dataSource" ref="dataSource" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
THX for your time.
Add below annotation to your testing class:
#TransactionConfiguration(transactionManager="txManager")
where txManager is the TranscationManager name defined in your Spring config file.
Related
Whenever I run my spring boot application I keeb getting the following message:
***************************
APPLICATION FAILED TO START
***************************
Description:
Field patchService in org.hisp.dhis.dxf2.metadata.objectbundle.DefaultObjectBundleService required a single bean, but 10 were found:
- org.hisp.dhis.patch.DefaultPatchService#0: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#1: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#2: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#3: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#4: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#5: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#6: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#7: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#8: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
- org.hisp.dhis.patch.DefaultPatchService#9: defined in URL [file:/D:/001Learning/JavaEE/Projects_FromNet/eagleboard2/eagleboard-services/eagleboard-service-core/target/classes/META-INF/dhis/beans.xml]
Action:
Consider marking one of the beans as #Primary, updating the consumer to accept multiple beans, or using #Qualifier to identify the bean that should be consumed
Process finished with exit code 1
Although Only one Service is declared in the following xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.3.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.3.xsd">
<bean id="org.eagleboard.preheat.PreheatService" class="org.eagleboard.preheat.DefaultPreheatService" scope="prototype">
<aop:scoped-proxy proxy-target-class="false" />
</bean>
<bean id="org.eagleboard.calendar.CalendarService" class="org.eagleboard.calendar.DefaultCalendarService" />
<bean class="org.eagleboard.calendar.impl.Iso8601Calendar" />
<bean class="org.eagleboard.calendar.impl.CopticCalendar" />
<bean class="org.eagleboard.calendar.impl.EthiopianCalendar" />
<bean class="org.eagleboard.calendar.impl.GregorianCalendar" />
<bean class="org.eagleboard.calendar.impl.IslamicCalendar" />
<bean class="org.eagleboard.calendar.impl.NepaliCalendar" />
<bean class="org.eagleboard.calendar.impl.ThaiCalendar" />
<bean class="org.eagleboard.calendar.impl.PersianCalendar" />
<bean id="org.eagleboard.query.planner.QueryPlanner" class="org.eagleboard.query.planner.DefaultQueryPlanner" />
<bean id="org.eagleboard.query.QueryParser" class="org.eagleboard.query.DefaultQueryParser" />
<bean id="org.eagleboard.query.CriteriaQueryEngine" class="org.eagleboard.query.CriteriaQueryEngine" />
<bean id="org.eagleboard.query.InMemoryQueryEngine" class="org.eagleboard.query.InMemoryQueryEngine" />
<bean id="org.eagleboard.query.QueryService" class="org.eagleboard.query.DefaultQueryService" />
<bean class="org.eagleboard.patch.DefaultPatchService" />
<bean id="org.eagleboard.render.RenderService" class="org.eagleboard.render.DefaultRenderService" />
<bean class="org.eagleboard.amqp.RabbitMQAmqpService" />
<bean id="org.eagleboard.interpretation.InterpretationStore" class="org.eagleboard.interpretation.hibernate.HibernateInterpretationStore">
<property name="clazz" value="org.eagleboard.interpretation.Interpretation" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!--Eagle Board part-->
<!-- Eagle Board Data Stores -->
<bean id="com.eagleboard.datafield.DataFieldStore" class="org.eagleboard.eagleboard.datafield.hibernate.HibernateDataFieldStore">
<property name="clazz" value="org.eagleboard.eagleboard.datafield.DataField" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="cacheable" value="true" />
</bean>
<bean id="com.eagleboard.fieldset.FieldSetStore" class="org.eagleboard.eagleboard.fieldset.hibernate.HibernateFieldSetStore">
<property name="clazz" value="org.eagleboard.eagleboard.fieldset.FieldSet" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="cacheable" value="true" />
</bean>
<bean id="com.eagleboard.todotask.TodoTaskStore" class="org.eagleboard.eagleboard.todotask.hibernate.HibernateTodoTaskStore">
<property name="clazz" value="org.eagleboard.eagleboard.todotask.TodoTask" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="cacheable" value="true" />
</bean>
<bean id="com.eagleboard.activity.ActivityStore" class="org.eagleboard.eagleboard.activity.hibernate.HibernateActivityStore">
<property name="clazz" value="org.eagleboard.eagleboard.activity.Activity" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="cacheable" value="true" />
</bean>
<bean id="com.eagleboard.project.ProjectStore" class="org.eagleboard.eagleboard.project.hibernate.HibernateProjectStore">
<property name="clazz" value="org.eagleboard.eagleboard.project.Project" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="cacheable" value="true" />
</bean>
<!-- Eagle Board Services -->
<bean id="org.eagleboard.eagleboard.datafield.DataFieldService" class="org.eagleboard.eagleboard.datafield.DefaultDataFieldService">
<property name="dataFieldStore" ref="com.eagleboard.datafield.DataFieldStore" />
</bean>
<bean id="org.eagleboard.eagleboard.fieldset.DefaultFieldSetService" class="org.eagleboard.eagleboard.fieldset.DefaultFieldSetService">
<property name="fieldSetStore" ref="com.eagleboard.fieldset.FieldSetStore" />
<property name="currentUserService" ref="org.eagleboard.user.CurrentUserService" />
</bean>
<bean id="org.eagleboard.eagleboard.todotask.DefaultTodoTaskService" class="org.eagleboard.eagleboard.todotask.DefaultTodoTaskService">
<property name="todoTaskStore" ref="com.eagleboard.todotask.TodoTaskStore" />
<property name="currentUserService" ref="org.eagleboard.user.CurrentUserService" />
</bean>
<bean id="org.eagleboard.eagleboard.activity.DefaultActivityService" class="org.eagleboard.eagleboard.activity.DefaultActivityService">
<property name="activityStore" ref="com.eagleboard.activity.ActivityStore" />
<property name="currentUserService" ref="org.eagleboard.user.CurrentUserService" />
</bean>
<bean id="org.eagleboard.eagleboard.project.DefaultProjectService" class="org.eagleboard.eagleboard.project.DefaultProjectService">
<property name="projectStore" ref="com.eagleboard.project.ProjectStore" />
<property name="currentUserService" ref="org.eagleboard.user.CurrentUserService" />
</bean>
<!-- Eagle Board DeletionHandlers -->
<bean id="org.eagleboard.eagleboard.datafield.DataFieldDeletionHandler" class="org.eagleboard.eagleboard.datafield.DataFieldDeletionHandler">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.eagleboard.eagleboard.fieldset.FieldSetDeletionHandler" class="org.eagleboard.eagleboard.fieldset.FieldSetDeletionHandler">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.eagleboard.eagleboard.todotask.TodoTaskDeletionHandler" class="org.eagleboard.eagleboard.todotask.TodoTaskDeletionHandler">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.eagleboard.eagleboard.activity.ActivityDeletionHandler" class="org.eagleboard.eagleboard.activity.ActivityDeletionHandler">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.eagleboard.eagleboard.project.ProjectDeletionHandler" class="org.eagleboard.eagleboard.project.ProjectDeletionHandler">
<property name="jdbcTemplate" ref="jdbcTemplate" />
</bean>
<bean id="org.eagleboard.indicator.IndicatorStore" class="org.eagleboard.indicator.hibernate.HibernateIndicatorStore">
<property name="clazz" value="org.eagleboard.indicator.Indicator" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.indicator.IndicatorTypeStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.indicator.IndicatorType" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.indicator.IndicatorGroupStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.indicator.IndicatorGroup" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.indicator.IndicatorGroupSetStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.indicator.IndicatorGroupSet" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.period.PeriodStore" class="org.eagleboard.period.hibernate.HibernatePeriodStore">
<property name="clazz" value="org.eagleboard.period.Period" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
<property name="transientIdentifiableProperties" value="true" />
</bean>
<bean id="org.eagleboard.expression.ExpressionStore" class="org.eagleboard.hibernate.HibernateGenericStore">
<property name="clazz" value="org.eagleboard.expression.Expression" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.user.UserStore" class="org.eagleboard.user.hibernate.HibernateUserStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.user.User" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.user.CurrentUserStore" class="org.eagleboard.user.hibernate.HibernateCurrentUserStore" />
<bean id="org.eagleboard.user.UserSettingStore" class="org.eagleboard.user.hibernate.HibernateUserSettingStore">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.user.UserAuthorityGroupStore" class="org.eagleboard.user.hibernate.HibernateUserAuthorityGroupStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.user.UserAuthorityGroup" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.user.UserCredentialsStore" class="org.eagleboard.user.hibernate.HibernateUserCredentialsStore">
<property name="clazz" value="org.eagleboard.user.UserCredentials" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.user.UserGroupStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.user.UserGroup" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.user.UserGroupAccessStore" class="org.eagleboard.hibernate.HibernateGenericStore">
<property name="clazz" value="org.eagleboard.user.UserGroupAccess" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.user.UserAccessStore" class="org.eagleboard.hibernate.HibernateGenericStore">
<property name="clazz" value="org.eagleboard.user.UserAccess" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.user.PasswordValidationService" class="org.eagleboard.user.DefaultPasswordValidationService" />
<bean id="org.eagleboard.user.PasswordHistoryValidationRule" class="org.eagleboard.user.PasswordHistoryValidationRule" />
<bean id="org.eagleboard.user.PasswordLengthValidationRule" class="org.eagleboard.user.PasswordLengthValidationRule" />
<bean id="org.eagleboard.user.DigitPatternValidationRule" class="org.eagleboard.user.DigitPatternValidationRule" />
<bean id="org.eagleboard.user.UpperCasePatternValidationRule" class="org.eagleboard.user.UpperCasePatternValidationRule" />
<bean id="org.eagleboard.user.SpecialCharacterValidationRule" class="org.eagleboard.user.SpecialCharacterValidationRule" />
<bean id="org.eagleboard.user.PasswordDictionaryValidationRule" class="org.eagleboard.user.PasswordDictionaryValidationRule" />
<bean id="org.eagleboard.user.UserParameterValidationRule" class="org.eagleboard.user.UserParameterValidationRule" />
<bean id="org.eagleboard.message.MessageConversationStore" class="org.eagleboard.message.hibernate.HibernateMessageConversationStore">
<property name="clazz" value="org.eagleboard.message.MessageConversation" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="statementBuilder" ref="statementBuilder" />
</bean>
<bean id="org.eagleboard.configuration.ConfigurationStore" class="org.eagleboard.hibernate.HibernateGenericStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.configuration.Configuration" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.constant.ConstantStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.constant.Constant" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.scheduling.JobConfigurationStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.scheduling.JobConfiguration" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.deletedobject.DeletedObjectStore" class="org.eagleboard.deletedobject.hibernate.HibernateDeletedObjectStore" />
<bean id="org.eagleboard.version.VersionStore" class="org.eagleboard.version.hibernate.HibernateVersionStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.version.Version" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.metadata.version.MetadataVersionStore"
class="org.eagleboard.metadata.version.hibernate.HibernateMetadataVersionStore">
<property name="sessionFactory" ref="sessionFactory" />
<property name="clazz" value="org.eagleboard.metadata.version.MetadataVersion" />
</bean>
<bean id="org.eagleboard.option.OptionSetStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.option.OptionSet" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.option.OptionStore" class="org.eagleboard.option.hibernate.HibernateOptionStore">
<property name="clazz" value="org.eagleboard.option.Option" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.option.OptionGroupStore" class="org.eagleboard.option.hibernate.HibernateOptionGroupStore">
<property name="clazz" value="org.eagleboard.option.OptionGroup" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.option.OptionGroupSetStore" class="org.eagleboard.option.hibernate.HibernateOptionGroupSetStore">
<property name="clazz" value="org.eagleboard.option.OptionGroupSet" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.legend.LegendSetStore"
class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.legend.LegendSet" />
<property name="sessionFactory" ref="sessionFactory" />
<property name="cacheable" value="true" />
</bean>
<bean id="org.eagleboard.i18n.I18nLocaleStore" class="org.eagleboard.i18n.hibernate.HibernateI18nLocaleStore">
<property name="clazz" value="org.eagleboard.i18n.locale.I18nLocale" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.keyjsonvalue.KeyJsonValueStore" class="org.eagleboard.keyjsonvalue.hibernate.HibernateKeyJsonValueStore">
<property name="clazz" value="org.eagleboard.keyjsonvalue.KeyJsonValue" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.userkeyjsonvalue.UserKeyJsonValueStore"
class="org.eagleboard.userkeyjsonvalue.hibernate.HibernateUserKeyJsonValueStore">
<property name="clazz" value="org.eagleboard.userkeyjsonvalue.UserKeyJsonValue" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.fileresource.FileResourceStore" class="org.eagleboard.common.hibernate.HibernateIdentifiableObjectStore">
<property name="clazz" value="org.eagleboard.fileresource.FileResource" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.fileresource.ExternalFileResourceStore"
class="org.eagleboard.fileresource.hibernate.HibernateExternalFileResourceStore">
<property name="clazz" value="org.eagleboard.fileresource.ExternalFileResource" />
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="org.eagleboard.fileresource.FileResourceContentStore" class="org.eagleboard.fileresource.JCloudsFileResourceContentStore">
<property name="configurationProvider" ref="dhisConfigurationProvider" />
<property name="locationManager" ref="locationManager" />
</bean>
<!-- File resource jobs -->
<bean id="org.eagleboard.fileresource.FileResourceUploadCallback" class="org.eagleboard.fileresource.FileResourceUploadCallback" />
<!--<bean id="fileResourceCleanUpJob" class="org.eagleboard.fileresource.FileResourceCleanUpJob" />-->
<!-- Service definitions -->
<!--<bean id="org.eagleboard.dataelement.DataElementGroupService" class="org.eagleboard.dataelement.DefaultDataElementGroupService" />-->
<bean id="org.eagleboard.indicator.IndicatorGroupService" class="org.eagleboard.indicator.DefaultIndicatorGroupService">
<property name="indicatorGroupStore" ref="org.eagleboard.indicator.IndicatorGroupStore" />
</bean>
<!--<bean id="org.eagleboard.dimension.DimensionService" class="org.eagleboard.dimension.DefaultDimensionService" />-->
<bean id="org.eagleboard.fileresource.FileResourceService" class="org.eagleboard.fileresource.DefaultFileResourceService">
<property name="fileResourceStore" ref="org.eagleboard.fileresource.FileResourceStore" />
<property name="fileResourceContentStore" ref="org.eagleboard.fileresource.FileResourceContentStore" />
<property name="schedulingManager" ref="org.eagleboard.scheduling.SchedulingManager" />
<property name="uploadCallback" ref="org.eagleboard.fileresource.FileResourceUploadCallback" />
</bean>
<bean id="org.eagleboard.fileresource.ExternalFileResourceService" class="org.eagleboard.fileresource.DefaultExternalFileResourceService">
<property name="externalFileResourceStore" ref="org.eagleboard.fileresource.ExternalFileResourceStore" />
</bean>
<bean id="org.eagleboard.indicator.IndicatorService" class="org.eagleboard.indicator.DefaultIndicatorService">
<property name="indicatorStore" ref="org.eagleboard.indicator.IndicatorStore" />
<property name="indicatorTypeStore" ref="org.eagleboard.indicator.IndicatorTypeStore" />
<property name="indicatorGroupStore" ref="org.eagleboard.indicator.IndicatorGroupStore" />
<property name="indicatorGroupSetStore" ref="org.eagleboard.indicator.IndicatorGroupSetStore" />
</bean>
<bean id="org.eagleboard.period.PeriodService" class="org.eagleboard.period.DefaultPeriodService">
<property name="periodStore" ref="org.eagleboard.period.PeriodStore" />
</bean>
<bean id="org.eagleboard.expression.ExpressionService" class="org.eagleboard.expression.DefaultExpressionService">
<property name="expressionStore" ref="org.eagleboard.expression.ExpressionStore" />
<property name="dataFieldService" ref="org.eagleboard.eagleboard.datafield.DataFieldService" />
<property name="constantService" ref="org.eagleboard.constant.ConstantService" />
<property name="idObjectManager" ref="org.eagleboard.common.IdentifiableObjectManager" />
</bean>
<bean id="org.eagleboard.user.UserSettingService" class="org.eagleboard.user.DefaultUserSettingService">
<property name="currentUserService" ref="org.eagleboard.user.CurrentUserService" />
<property name="userSettingStore" ref="org.eagleboard.user.UserSettingStore" />
<property name="userService" ref="org.eagleboard.user.UserService" />
<property name="systemSettingManager" ref="org.eagleboard.setting.SystemSettingManager" />
</bean>
PatchService interface:
public interface PatchService
{
Patch diff( PatchParams params );
void apply( Patch patch, Object target );
}
DefaultPatchService.java implementing that interface
public class DefaultPatchService implements PatchService
{
private static final Log log = LogFactory.getLog( DefaultPatchService.class );
private final SchemaService schemaService;
private final QueryService queryService;
private final AmqpService amqpService;
private final MetadataAuditService metadataAuditService;
private final CurrentUserService currentUserService;
private final RenderService renderService;
private final SystemService systemService;
public DefaultPatchService( SchemaService schemaService, QueryService queryService, AmqpService amqpService,
MetadataAuditService metadataAuditService, CurrentUserService currentUserService, RenderService renderService, SystemService systemService )
{
this.schemaService = schemaService;
this.queryService = queryService;
this.amqpService = amqpService;
this.metadataAuditService = metadataAuditService;
this.currentUserService = currentUserService;
this.renderService = renderService;
this.systemService = systemService;
}
...
DefaultObjectBundleService.java in which the DefaultPatchService is Autowired using the interface it implements PatchService which implemented only by it, no other service implementing this interface.
#Service
#Transactional
public class DefaultObjectBundleService implements ObjectBundleService
{
private static final LoggingManager.Logger log = LoggingManager
.createLogger( DefaultObjectBundleService.class );
#Autowired
private CurrentUserService currentUserService;
#Autowired
private PreheatService preheatService;
#Autowired
private SchemaService schemaService;
#Autowired
private SessionFactory sessionFactory;
#Autowired
private IdentifiableObjectManager manager;
#Autowired
private DbmsManager dbmsManager;
#Autowired
private HibernateCacheManager cacheManager;
#Autowired
private Notifier notifier;
#Autowired
private MergeService mergeService;
#Autowired
private DeletedObjectService deletedObjectService;
#Autowired
private PatchService patchService;
#Autowired
private MetadataAuditService metadataAuditService;
#Autowired
private RenderService renderService;
#Autowired
private SystemService systemService;
#Autowired
private AmqpService amqpService;
#Autowired( required = false )
private List<ObjectBundleHook> objectBundleHooks = new ArrayList<>();
#Override
public ObjectBundle create( ObjectBundleParams params )
{
PreheatParams preheatParams = params.getPreheatParams();
if ( params.getUser() == null )
{
params.setUser( currentUserService.getCurrentUser() );
}
preheatParams.setUser( params.getUser() );
preheatParams.setObjects( params.getObjects() );
ObjectBundle bundle = new ObjectBundle( params, preheatService.preheat( preheatParams ), params.getObjects() );
bundle.setObjectBundleStatus( ObjectBundleStatus.CREATED );
bundle.setObjectReferences( preheatService.collectObjectReferences( params.getObjects() ) );
return bundle;
}
...
...
could someone help me, please, also the project have multiple modules, Does dependency between modules have something to do with the problem
I changed the service xml definition from this:
<bean class="org.eagleboard.patch.DefaultPatchService" />
to this:
<bean id="org.eagleboard.patch.PatchService" class="org.eagleboard.patch.DefaultPatchService" />
and the error stopped showing up.
many thanks for all.
Hi i am trying to create a XA transaction for camel and jdbc using atomikos but i have JNDI to set up a XA jdbc transaction i am having issues configuring it.
Below is my code and i am getting cannot write to the class exception
<!-- Atomikos and Spring transaction configuration -->
<!-- JMS config; with XAConnectionFactory -->
<bean id="xa.amqConnectionFactory" class="org.apache.activemq.spring.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
<!-- nothing transactional here, this connection factory will be used from the test harness -->
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616"/>
</bean>
<!-- Atomikos JTA configuration, nothing specific to Spring here -->
<bean id="atomikos.connectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName" value="My_MQSeries_XA_RMI"/>
<property name="xaConnectionFactory" ref="xa.amqConnectionFactory"/>
<!-- XAConnectionFactory -->
<property name="maxPoolSize" value="10"/>
<property name="ignoreSessionTransactedFlag" value="false"/>
</bean>
<!-- database config; the XADataSource bean is both a DataSource and an XADataSource-->
<!-- <import resource="xa-embedded-db-context.xml"/> -->
<bean id="db2jndi" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value = "jndi NAMe"/>
</bean>
<!-- <bean id="XADataSource" class="MyDAOclass">
<property name="MyDAOmethod" ref="db2jndi"/>
</bean> -->
<bean id="atomikos.dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean">
<property name="xaDataSource" ref="XADataSource"/>
<!-- XADataSource -->
</bean>
<!-- javax.transaction.TransactionManager -->
<bean id="atomikos.transactionManager"
class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init"
destroy-method="close"
depends-on="atomikos.connectionFactory,atomikos.dataSource">
<property name="forceShutdown" value="false"/>
</bean>
<!-- javax.transaction.UserTransaction -->
<bean id="atomikos.userTransaction"
class="com.atomikos.icatch.jta.UserTransactionImp">
<property name="transactionTimeout" value="300"/>
</bean>
<!-- This is the Spring wrapper over the JTA configuration -->
<!-- org.springframework.transaction.PlatformTransactionManager -->
<bean id="jta.transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikos.transactionManager"/>
<property name="userTransaction" ref="atomikos.userTransaction"/>
</bean>
<!-- Camel components -->
<bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory" ref="atomikos.connectionFactory"/>
<property name="transactionManager" ref="jta.transactionManager"/>
</bean>
<!-- this component is used only from the test harness -->
<bean id="nonTxJms" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory" ref="connectionFactory"/>
</bean>
<bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="atomikos.dataSource"/>
</bean>
<!-- Policy -->
<bean id="PROPAGATION_REQUIRED" class="org.apache.camel.spring.spi.SpringTransactionPolicy">
<property name="transactionManager" ref="jta.transactionManager"/>
<!-- Atomikos TX Manager -->
<property name="propagationBehaviorName" value="PROPAGATION_REQUIRED"/>
</bean>
If anyone has worked on apache camel using XA transactions can you guys provide me your sample config file so that i can use and modify it.
This works for me. It looks like you've missed the ActiveMQResourceManager. Also ensure you use a XAPooledConnectionFactory otherwise your MDBs will disconnect after every bind to check for a message (and CPU on the broker will go through the roof).
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd">
<bean id="env" class="java.lang.String">
<constructor-arg value="test-junit"/>
</bean>
<!-- JMS configuration -->
<bean id="resourceManager" class="org.apache.activemq.pool.ActiveMQResourceManager"
init-method="recoverResource">
<property name="transactionManager" ref="atomikosTransactionManager" />
<property name="connectionFactory" ref="pooledJmsXaConnectionFactory" />
<property name="resourceName" value="activemq.default" />
</bean>
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikosTransactionManager" />
<property name="userTransaction" ref="userTransaction" />
</bean>
<bean id="pooledJmsXaConnectionFactory" class="org.apache.activemq.pool.XaPooledConnectionFactory"
init-method="start" destroy-method="stop">
<property name="maxConnections" value="8" />
<property name="connectionFactory" ref="jmsXaConnectionFactory" />
<property name="transactionManager" ref="atomikosTransactionManager" />
</bean>
<!-- <bean id="pooledJmsXaConnectionFactory" class="com.atomikos.jms.AtomikosConnectionFactoryBean"
init-method="init" destroy-method="close"> <property name="poolSize" value="8"
/> <property name="uniqueResourceName" value="activemq" /> <property name="xaConnectionFactory"
ref="jmsXaConnectionFactory" /> </bean> -->
<bean id="jmsXaConnectionFactory" class="org.apache.activemq.ActiveMQXAConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
<property name="redeliveryPolicy">
<bean class="org.apache.activemq.RedeliveryPolicy">
<property name="maximumRedeliveries" value="0" />
</bean>
</property>
</bean>
<bean id="jms" class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="connectionFactory" ref="pooledJmsXaConnectionFactory" />
<property name="transacted" value="false" />
<property name="transactionManager" ref="transactionManager" />
</bean>
<!-- JMS configuration for test enqueue/dequeue without transactions -->
<bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://localhost:61616" />
</bean>
<bean id="myEmf"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="persistenceXmlLocation" value="classpath:META-INF/test-persistence.xml"/>
</bean>
<!-- JDBC configuration -->
<bean id="dataSource" class="org.apache.commons.dbcp2.managed.BasicManagedDataSource">
<property name="transactionManager" ref="atomikosTransactionManager" />
<!-- <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedXADataSource40" /> -->
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" />
<property name="url" value="jdbc:derby:target/testdb;create=true" />
<property name="defaultAutoCommit" value="false" />
</bean>
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<property name="forceShutdown" value="false" />
</bean>
<bean id="userTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
<property name="transactionTimeout" value="120" />
</bean>
<!-- -->
<bean id="springContext" class="org.example.testutils.SpringContext"/>
</beans>
I have a weird issue: entity manager can't create named query, I'm getting java.lang.IllegalArgumentException: Named query not found while methods, like find() and merge(), works. createQuery() also works. I'm using Hibernate as JPA provider and Spring as DI container. Code and configs are follows:
spring-beans.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<context:component-scan base-package="org.example.testapp.database" />
<bean id="newsForm" class="org.example.testapp.presentation.form.NewsForm">
<property name="newsMessage" ref="news" />
<property name="newsList">
<list>
<ref bean="news" />
</list>
</property>
</bean>
<bean name="news" class="org.example.testapp.model.News">
</bean>
<bean name="/news" class="org.example.testapp.presentation.action.NewsAction"
scope="prototype">
<property name="dao" ref="dao" />
</bean>
<bean id="dao" class="org.example.testapp.database.dao.JpaHibernateNewsDao"
scope="singleton">
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="org.example.testapp.model"/>
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
</bean>
<bean id="jpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="ORACLE" />
<property name="showSql" value="true" />
<property name="generateDdl" value="false" />
<property name="databasePlatform" value="org.hibernate.dialect.Oracle10gDialect" />
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:#localhost:1521:xe" />
<property name="username" value="login" />
<property name="password" value="password" />
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="dataSource" ref="dataSource" />
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<context:annotation-config/>
<tx:annotation-driven transaction-manager="transactionManager" />
news.java
#Entity
#NamedQueries({
#NamedQuery(name="News.select", query="select n from News n order by news_date" ),
#NamedQuery(name="News.delete", query="delete from News where id in :value_list")
})
#Table(name="news")
public class News {
jpadao.java
public class JpaHibernateNewsDao implements Dao {
#PersistenceContext
private EntityManager entityManager;
#SuppressWarnings("unchecked")
#Override
#Transactional
public List<News> getList() throws DaoException {
List<News> news = entityManager.createNamedQuery("News.select").getResultList();
return news;
}
Found a answer: Spring just didn't see #Entity, so there was really no such #NamedQuery. Now I have to figure, why this config didn't work:
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="org.example.testapp.model"/>
<property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
And one entityManagerFactory in spring-server.xml.
But i must generate one more entityManager, and i do it with
Persistence.createEntityManagerFactory("myotherpersistenceunitname");
but i get exception
Caused by: net.sf.ehcache.CacheException: Another unnamed CacheManager already exists in the same VM. Please provide unique names for each CacheManager in the config or do one of following:
1. Use one of the CacheManager.create() static factory methods to reuse same CacheManager with same name or create one if necessary
2. Shutdown the earlier cacheManager before creating new one with same name.
The source of the existing CacheManager is: DefaultConfigurationSource [ ehcache.xml or ehcache-failsafe.xml ]
at net.sf.ehcache.CacheManager.assertNoCacheManagerExistsWithSameName(CacheManager.java:457)
at net.sf.ehcache.CacheManager.init(CacheManager.java:354)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:242)
at net.sf.ehcache.hibernate.EhCacheRegionFactory.start(EhCacheRegionFactory.java:70)
spring.xml:
<context:property-placeholder location="classpath:application.properties"/>
<context:component-scan base-package="merve.web.app" >
<context:exclude-filter expression="org.springframework.stereotype.Controller" type="annotation" />
</context:component-scan>
<context:annotation-config/>
<tx:annotation-driven transaction-manager="txManager" proxy-target-class="true" />
<cache:annotation-driven />
<bean id="properties" class="merve.web.app.configuration.PropertyResourceConfiguration" />
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="myPU"/>
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="${database.target}"/>
<property name="showSql" value="${database.showSql}" />
</bean>
</property>
</bean>
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${database.driver}"/>
<property name="jdbcUrl" value="${database.url}"/>
<property name="user" value="${database.username}"/>
<property name="password" value="${database.password}"/>
<property name="minPoolSize" value="2"/>
<property name="maxPoolSize" value="10"/>
<property name="breakAfterAcquireFailure" value="false"/>
<property name="acquireRetryAttempts" value="3"/>
<property name="idleConnectionTestPeriod" value="300" />
<property name="testConnectionOnCheckout" value="true" />
</bean>
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<bean id="jamesEntityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="jamesPU"/>
<property name="dataSource" ref="dataSourceJames" />
<property name="persistenceXmlLocation" value="classpath:META-INF/james-persistence.xml"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="databasePlatform" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="showSql" value="true" />
</bean>
</property>
</bean>
<bean id="dataSourceJames" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="jdbcUrl" value="jdbc:derby:../var/store/derby;create=true"/>
<property name="user" value="app"/>
<property name="password" value="app"/>
<property name="minPoolSize" value="2"/>
<property name="maxPoolSize" value="10"/>
<property name="breakAfterAcquireFailure" value="false"/>
<property name="acquireRetryAttempts" value="3"/>
<property name="idleConnectionTestPeriod" value="300" />
<property name="testConnectionOnCheckout" value="true" />
</bean>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basenames">
<list>
<value>messages</value>
</list>
</property>
</bean>
<!-- Ehcache library setup -->
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean" p:shared="true" p:config-location="classpath:ehcache.xml"/>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" >
<property name="cacheManager"><ref local="ehcache"></ref></property>
</bean>
<dwr:configuration/>
<dwr:annotation-scan base-package="tuxi.web.app.service.dwr" scanRemoteProxy="true" scanDataTransferObject="true"/>
<dwr:url-mapping />
<dwr:controller id="dwrController"/>
</beans>
The problem, described here, and fixed in the source is not using the EhCache singleton correctly. The answer depends on which version of spring-context-support AND which version of EhCache you are using. For both, you need to be using EhCache 2.6 or greater:
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>2.6.0</version>
</dependency>
Next, determine what to do based on your spring-context-support version:
If using Spring 3.1/3.2
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
p:shared="true"
p:config-location="classpath:ehcache.xml"/>
If using Spring 4.x
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
p:shared="false"
P:acceptExisting="true"
p:config-location="classpath:ehcache.xml"/>
Try naming both cacheManagers differently in ehcache.xml
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="ehCacheManager1">
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="ehCacheManager2">
I understand that the ApplicationContext can be annotation based in Spring 3.
Can anybody please share an example , so that I could refer the same.
Thanks in advance,
Vivek
EDIT - This is the XML configuration:
<context:annotation-config />
<context:component-scan base-package="com.test" />
<mvc:annotation-driven />
<bean id="dataSource" destroy-method="close" class=org.apache.commons.dbcp.BasicDataSource ">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/test" />
<property name="username" value="test" />
<property name="password" value="test" />
</bean>
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="mapper" class="org.mybatis.spring.mapper.MapperFactoryBean">
<property name="mapperInterface" value="com.test.Mapper" />
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="dao" class="com.test.MapperDao">
<property name="mapper" ref="mapper" />
</bean>
<bean id="Controller" class="com.test.Controller" />
I have been through the Spring 3 Documentation and understood the #Configuration annotation.
So issue resolved :)