我发现了 Tynamo 团队在 Tapestry 和 Resteasy 之间所做的精彩整合工作。
我正在尝试在 Web 服务上激活 Liveclass Reloading。根据文档说:
文档
要为 REST 服务启用实时类重新加载,您唯一需要做的就是将它们绑定为常规 Tapestry IoC 服务并将它们贡献给 javax.ws.rs.core.Application.class。阅读更多关于服务实现重新加载如何工作的信息:http: //tapestry.apache.org/reload.html
这是来自tapestry-resteasy 测试套件的示例。
public static void bind(ServiceBinder binder)
{
binder.bind(ReloadableEchoResource.class, ReloadableEchoResourceImpl.class);
}
@Contribute(javax.ws.rs.core.Application.class)
public static void configureRestResources(Configuration<Object> singletons, ReloadableEchoResource reloadableEchoResource)
{
singletons.add(reloadableEchoResource);
}
我自己的作品
这正是我正在做的(嗯......嗯至少我相信它是;D):
我的绑定
public static void bind(ServiceBinder binder)
{
binder.bind(PushMessageService.class, GCMPushMessageServiceImpl.class);
binder.bind(UserService.class, HibernateUserServiceImpl.class);
binder.bind(IUserResource.class, UserResourceImpl.class);
}
/**
* Contributions to the RESTeasy main Application, insert all your RESTeasy singletons services here.
*/
@Contribute(javax.ws.rs.core.Application.class)
public static void configureRestResources(Configuration<Object> singletons, IUserResource userResource)
{
singletons.add(userResource);
}
我的界面
@Path("/user")
public interface IUserResource {
/**
* Lecture de tous les utilisateurs
*
* @return une List des utilisateurs existants
*/
@GET
@Produces("application/json")
public abstract List<User> getAllDomains();
错误
但是当我启动我的应用程序时,我会收到以下消息:
HTTP ERROR 500
Problem accessing /user. Reason:
Exception constructing service 'ResteasyRequestFilter': Error building service proxy for service 'Application' (at org.tynamo.resteasy.Application(Collection) (at Application.java:14) via org.tynamo.resteasy.ResteasyModule.bind(ServiceBinder) (at ResteasyModule.java:31)): Error invoking service contribution method org.tynamo.resteasy.ResteasyModule.javaxWsRsCoreApplication(Configuration, ObjectLocator, ResteasyPackageManager, ClassNameLocator): Class com.sopragroup.ecommerce.mobile.rest.IUserResource does not contain a public constructor needed to autobuild.
Caused by:
java.lang.RuntimeException: Exception constructing service 'ResteasyRequestFilter': Error building service proxy for service 'Application' (at org.tynamo.resteasy.Application(Collection) (at Application.java:14) via org.tynamo.resteasy.ResteasyModule.bind(ServiceBinder) (at ResteasyModule.java:31)): Error invoking service contribution method org.tynamo.resteasy.ResteasyModule.javaxWsRsCoreApplication(Configuration, ObjectLocator, ResteasyPackageManager, ClassNameLocator): Class com.sopragroup.ecommerce.mobile.rest.IUserResource does not contain a public constructor needed to autobuild.
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.obtainObjectFromCreator(JustInTimeObjectCreator.java:75)
at org.apache.tapestry5.ioc.internal.services.JustInTimeObjectCreator.createObject(JustInTimeObjectCreator.java:54)
这就像自动绑定不起作用(确实我认为它是)。显然,当我尝试不创建界面和绑定时,它就像一个魅力。
有人可以给我一个线索吗?