[#4314] - Use bean reference instead of class name in CustomDataSource

Category:
Feature request
Priority:
Normal
Status:
New
Project: Severity:
Minor
Resolution:
Open
Component: Reproducibility:
Always
Assigned to:

I've setup a custom data source. My custom applicationContext file looks like this:

<bean id="customDataSource"
class="com.jaspersoft.jasperserver.api.engine.jasperreports.util.CustomDataSourceDefinition">
<property name="factory" ref="customDataSourceServiceFactory"/>
<property name="name" value="customDataSource"/>
<property name="serviceClassName" value="com.MyDataSourceService"/>
</bean>

As the property "serviceClassName" states, it expects a full class name. CustomReportDataSourceServiceFactory.createService(81) will create a new instance of this class and do its magic. The problem with this approach is that we are unable to use a spring bean with injected beans (e.g. a web service bean) because you create a totally new instance instead of injecting an existing bean. If we would be able to define the data source service as follows, then spring beans could be injected and data could be gathered via spring beans.

<property name="serviceClass" ref="myDataSourceService" />

Is it possible to implement this, or should we use another approach to
accomplish this?

timstorms's picture
Joined: Sep 17 2009 - 2:03am
Last seen: 13 years 8 months ago
Feedback