---
layout: docs
title: Embedding rules engine
header: Embedding rules engine
prev_section: user-guide/scheduling-rules-engine
next_section: tutorials/hello-world
doc: true
---
Easy Rules is a lightweight library that can be used in a standalone Java application or embedded in a web server or a DI container.
As of version {{ site.version }}, Easy Rules provides support for Spring.
Support for other DI containers will be added in future versions.
In this section, you will learn how to configure rules and rules engine as Spring beans.
First you need to add the following dependency to your **_pom.xml_**:
```xml
org.easyrules
easyrules-spring
{{site.version}}
```
Then, you can configure your rules and the rules engine as follows:
```xml
```
The `RulesEngineFactoryBean` is responsible for creating rules engine instances.
As you can see, this factory bean is the main entry point to configure:
* Rules
* Rules listeners
* And engine parameters (priority threshold, skipOnFirstAppliedRule, silentMode, etc)
To get the engine and fires rules, you can use the following snippet:
```java
ApplicationContext context = new ClassPathXmlApplicationContext("application-context.xml");
RulesEngine rulesEngine = (RulesEngine) context.getBean("rulesEngine");
rulesEngine.fireRules();
```
Hint:
The main advantage of using Easy Rules with Spring is the ability to register/unregister rules through the Xml configuration
without recompiling your application.
You can find a complete tutorial on how to use Easy Rules with Spring [here]({{site.url}}/tutorials/spring-tutorial.html).