java - Is it possible to annotated the interface for a method validation using BeanValidation? -
i have following structure ina project using learn javaee7:
bean:
@stateless public class mybean implements myinterface{ public string lookup(@notnull string text){ return "found3"; } }
interface:
public interface myinterface { public string lookup(@notnull string text); }
and second bean:
public class helloworld { @inject private myinterface bean; public string getmessage() { return bean.lookup(null); } }
my server wildfly 8.2.
i have lookup method validated when calling it, annotated parameter doesn't accept null.
the problem code runs ok when call helloworld.getmessages() (i return value "found3".
if copy validation form myinterface mybean, validaiton exception wanted.
is possible declare validation in interface? how do that?
Comments
Post a Comment