magnolia-context-annotations
Usage
After installing this module in your magnolia deployment (taking the maven dependency is enough), you can do in stead of
@Override
public String stuff() {
return MgnlContext.doInSystemContext((MgnlContext.Op<String, Throwable>)
() -> actualStuff());
}
@Override
@MgnlSystemContext
public String stuff() {
return actualStuff();
}
It’s a bit like javax.transaction.Transactional
The annotation can also be used at class level, so you can quite easily mark all methods of a complete utility class to be executed in system context.
Installation
<dependency>
<groupId>nl.vpro</groupId>
<artifactId>magnolia-context-annotations</artifactId>
<version>1.2.0</version>
</dependency>