Hi, Yes your write.I am also confusing about it,after reading the documentation.And another thing is ,You declared two services in same application context is it not loading service two times. i.e first instatntiate the EaElementService implementation ,after that EaPackageService implementation and EaElementService implementation.That means EaElementService implemenation bean intstantiation takesplace two times,have you observed this ,if you are using same application context for more than one service?
According my understanding with out <sca:service> and <sca:reference> tags we can define spring beans as components; Thank you. On Fri, Apr 4, 2014 at 5:18 AM, Matt Shaw <[email protected]> wrote: > Hi, > > I am using spring as an implementation for one of my composites. The only > way I could get to work was to make the spring application context beans > SCA aware. From reading the tuscany documentation I am a little confused > with the following statement. > > " > > - A component that uses Spring for an implementation can wire SCA > services and references without introducing SCA metadata into the Spring > configuration. > The Spring context knows very little about the SCA environment. > > " > > Found here: http://tuscany.apache.org/sca-java-implementationspring.html > > I though this implied that I would need to SCA metadata/tags in my spring > application context. Which promotes the SCA goal of re-use? However the > composite will not load without it? Below are my composite and spring > application context files. > > <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi=" > http://www.w3.org/2001/XMLSchema-instance" > xmlns:sca="http://www.springframework.org/schema/sca" > xmlns:task="http://www.springframework.org/schema/task" > xsi:schemaLocation="http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans.xsd > http://www.springframework.org/schema/sca > http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd > http://www.springframework.org/schema/task > http://www.springframework.org/schema/task/spring-task-3.0.xsd" > default-autowire="byName"> > > > <sca:service name="EaElementService" > type="qhealth.thebox.earcl.jaxrs.JaxrsEaElementService" > target="EaElementBean"/> > <sca:service name="EaPackageService" > type="qhealth.thebox.earcl.jaxrs.JaxrsEaPackageService" > target="EaPackageBean"/> > > <bean id="EaElementBean" > class="qhealth.thebox.earcl.jaxrs.impl.EaElementServiceImpl"> > <property name="eaElementRepository" ref="eaElementRepository"/> > </bean> > > <bean id="EaPackageBean" > class="qhealth.thebox.earcl.jaxrs.impl.EaPackageServiceImpl"> > <property name="eaPackageRepository" ref="eaPackageRepository"/> > </bean> > > <bean id="eaElementRepository" > class="qhealth.thebox.earcl.jdbc.impl.JdbcEaElementRepository"> > <property name="dataSource" ref="dataSource"/> > <property name="eaConnectorRepository" > ref="eaConnectorRepository"/> > </bean> > <bean id="eaConnectorRepository" > class="qhealth.thebox.earcl.jdbc.impl.JdbcEaConnectorRepository"> > <property name="dataSource" ref="dataSource"/> > </bean> > > <bean id="eaPackageRepository" > class="qhealth.thebox.earcl.jdbc.impl.JdbcEaPackageRepository"> > <property name="dataSource" ref="dataSource"/> > <property name="eaElementRepository" ref="eaElementRepository"/> > </bean> > > <!-- > <bean id="dataSource" > class="org.springframework.jdbc.datasource.DriverManagerDataSource"> > <property name="driverClassName" > value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/> > <property name="url" > value="jdbc:sqlserver://10.80.48.23;databaseName=QCH > Architecture Sandpit"/> > <property name="username" value="the_box"/> > <property name="password" value="veryhard2guess"/> > </bean> > --> > > <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/ea_qhealth"/> > <property name="username" value="eaqhealth"/> > <property name="password" value="eaqhealth"/> > </bean> > > <bean id="transactionManager" > class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> > <property name="dataSource" ref="dataSource"/> > </bean> > > </beans> > > > > ------ Composite > > <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" > xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" > xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1" > targetNamespace=" > http://www.health.qld.gov.au/xmlns/thebox/composites/1.0" > name="thebox"> > > > <!-- Component Declarations --> > <component name="EaElementComponent"> > <implementation.spring > location="earcl-integration-test-context.xml"/> > <service name="EaElementService"> > <interface.java > interface="qhealth.thebox.earcl.jaxrs.JaxrsEaElementService"/> > <tuscany:binding.rest uri="/elements"> > <tuscany:wireFormat.json /> > <tuscany:operationSelector.jaxrs /> > </tuscany:binding.rest> > </service> > </component> > > <component name="EaPackageComponent"> > <implementation.spring > location="earcl-integration-test-context.xml"/> > <service name="EaPackageService"> > <interface.java > interface="qhealth.thebox.earcl.jaxrs.JaxrsEaPackageService"/> > <tuscany:binding.rest uri="/packages"> > <tuscany:wireFormat.json /> > <tuscany:operationSelector.jaxrs /> > </tuscany:binding.rest> > </service> > > </component> > > </composite> >
