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.