implement feature #29 : add @SpringRule meta annotation
parent
eedfaa52ec
commit
7087546e2d
@ -0,0 +1,19 @@
|
||||
package org.easyrules.samples.spring;
|
||||
|
||||
import org.easyrules.annotation.Action;
|
||||
import org.easyrules.annotation.Condition;
|
||||
import org.easyrules.spring.SpringRule;
|
||||
|
||||
@SpringRule
|
||||
public class AnotherDummyRule {
|
||||
|
||||
@Condition
|
||||
public boolean when() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Action
|
||||
public void then(){
|
||||
System.out.println("Hey, I'm annotated with @SpringRule");
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package org.easyrules.spring;
|
||||
|
||||
import org.easyrules.annotation.Rule;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation that turns a POJO into:
|
||||
*
|
||||
* <ul>
|
||||
* <li>an Easy Rules rule</li>
|
||||
* <li>a Spring prototype-scoped bean</li>
|
||||
* </ul>
|
||||
*
|
||||
* @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
|
||||
*/
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
@Rule
|
||||
@Component
|
||||
@Scope("prototype")
|
||||
public @interface SpringRule {
|
||||
}
|
Loading…
Reference in New Issue