add note about prototype scoped rules

pull/27/head
Mahmoud Ben Hassine 10 years ago
parent cbe6cf824d
commit 0f696ad565

@ -5,7 +5,7 @@
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- configure rule -->
<bean id="rule" class="org.easyrules.samples.spring.DummyRule"/>
<bean id="rule" class="org.easyrules.samples.spring.DummyRule" scope="prototype"/>
<!-- configure rules engine -->
<bean id="rulesEngine" class="org.easyrules.spring.RulesEngineFactoryBean">

@ -33,7 +33,7 @@ Then, you can configure your rules and the rules engine as follows:
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- configure rule -->
<bean id="rule" class="DummyRule"/>
<bean id="rule" class="DummyRule" scope="prototype"/>
<!-- configure rule listener -->
<bean id="ruleListener" class="DummyRuleListener"/>
@ -66,6 +66,12 @@ As you can see, this factory bean is the main entry point to configure:
* Rules listeners
* And engine parameters (priority threshold, skipOnFirstAppliedRule, silentMode, etc)
<div id="thread-safety" class="note info">
<h5>Heads up!</h5>
<p>If your rules are not thread safe, you should consider make them of scope <strong>prototype</strong>.</p>
<p>The rules engine instance returned by the <code>RulesEngineFactoryBean</code> is already of scope <strong>prototype</strong>.</p>
</div>
To get the engine and fires rules, you can use the following snippet:
```java
@ -75,7 +81,7 @@ RulesEngine rulesEngine = (RulesEngine) context.getBean("rulesEngine");
rulesEngine.fireRules();
```
<div class="note info">
<div class="note">
<h5>Hint:</h5>
<p>The main advantage of using Easy Rules with Spring is the ability to register/unregister rules through the Xml configuration
without recompiling your application.</p>

Loading…
Cancel
Save