Skip to content

Setting up modelfactory using spring

Michael Guymon edited this page Nov 6, 2013 · 8 revisions

Example

Spring Bean for setting up a ModelFactory. Note the use of the prototype scope, this is necessary if a Policy is used that is not global to the creation of all models.


<bean id="modelFactory" class="com.tobedevoured.modelcitizen.ModelFactory" scope="prototype">
        <property name="registerBlueprints">
            <list>
                <value>com.tobedevoured.modelcitizen.blueprint.CarBlueprint</value>
                <value>com.tobedevoured.modelcitizen.blueprint.WheelBlueprint</value>
                <value>com.tobedevoured.modelcitizen.blueprint.DriverBlueprint</value>
            </list>
        </property>
</bean>

or using the package scanner to find Blueprints


<bean id="modelFactory" class="com.tobedevoured.modelcitizen.ModelFactory" scope="prototype">
        <property name="registerBlueprintsByPackage" value="com.tobedevoured.modelcitizen" />
</bean>
Clone this wiki locally