Hi,
I was able to make my Dmi classes participate in Guice dependencty injection with a factory, as I explained here: https://forums.smartclient.com/forum...ce-server-side
The DmiFactory gets an instance of the Guice injector and creates an instance of the Dmi class with this injector. In such a way, the Dmi is able to use injected objects. This works fine.
Now I need to inject objects to a Datasource:
In my datasources I have a serverConstructor:
I suppose SmartGWT creates an instance of this using "new org.myapp.MyDataSource()" (with no arguments).
Is there a way to use a factory here, analogous as the factory in the Dmi? In my Dmis I use this:
With this code, the Dmi is not longer created with "new Dmi()" but using the factory. I need an analogous way to use a factory for a Datasource. The datasource should not be longer created using "new MyDataSource()" but using the factory. Is this possible?
Using smartgwt 6.1p power.
I was able to make my Dmi classes participate in Guice dependencty injection with a factory, as I explained here: https://forums.smartclient.com/forum...ce-server-side
The DmiFactory gets an instance of the Guice injector and creates an instance of the Dmi class with this injector. In such a way, the Dmi is able to use injected objects. This works fine.
Now I need to inject objects to a Datasource:
In my datasources I have a serverConstructor:
Code:
<DataSource ID="myDatasource" serverType="sql" tableName="myTable" serverConstructor="org.myapp.MyDataSource">
Is there a way to use a factory here, analogous as the factory in the Dmi? In my Dmis I use this:
Code:
<operationBinding operationType="custom"> <serverObject className="org.myapp.DmiFactory" lookupStyle="factory" />
Using smartgwt 6.1p power.
Comment