examples that I've found讨论了如何在unmarshaller
对象上设置验证处理程序。如何在Jersey中使用Moxy注册ValidationEventHandler?
但是,使用Jersey,MOXy/JAXB为我初始化,我不知道如何访问unmarshaller。
目前,我像这样引导Jersey,jersey-media-moxy
在类路径上。
@ApplicationPath("rest")
public class ApplicationConfig extends ResourceConfig {
Logger logger = LoggerFactory.getLogger(ApplicationConfig.class);
public ApplicationConfig() {
// Scan classes in this package and subpackages
logger.info("Registering REST Application");
packages("rest");
register(new AbstractBinder() {
@Override
protected void configure() {
// used to automatically inject a Connection instance and close it
bindFactory(ConnectionFactory.class).to(Connection.class)
.proxy(true).proxyForSameScope(false).in(RequestScoped.class);
}
});
}
}
用这种方法,我怎么能注册的解组一个ValidationEventHandler
?