我想用以下技术来开发平静的web服务。Restful webservices(Apache wink + Guice + openjpa)
Apache wink + Guice3 + openjpa。我不知道如何使用眨眼和openjpa的guice。你能解释一下吗?
我想用以下技术来开发平静的web服务。Restful webservices(Apache wink + Guice + openjpa)
Apache wink + Guice3 + openjpa。我不知道如何使用眨眼和openjpa的guice。你能解释一下吗?
我无法帮助您使用OpenJPA,但我现在想通过使用Guice
和Wink
。首先,您不需要像使用普通Web应用程序那样使用Guice的guice-servlet
JAR。只要将webapp设置为像往常一样使用Wink,然后按照以下步骤操作即可。
wink-server
JAR替换为wink-guice-server
JAR(可从相同来源获得)。改变你web.xml
文件servlet-class
从
org.apache.wink.server.internal.servlet.RestServlet
到
org.apache.wink。 guice。 server.internal.servlet。 吉斯 RestServlet
而且在web.xml
,这个片段添加到表情的<servlet-class>
元素:
<init-param>
<param-name>deploymentConfiguration</param-name>
<param-value>com.yourco.yourproj.DeploymentConfiguration</param-value>
</init-param>
最后,创建一个新的眨眼DeploymentConfiguration
类,我称之为这里com.yourco.yourproj.DeploymentConfiguration
。
package com.yourco.yourproj;
import com.google.inject.Module;
import org.apache.wink.guice.server.internal.GuiceDeploymentConfiguration;
import org.apache.wink.guice.server.internal.lifecycle.WinkGuiceModule;
public class DeploymentConfiguration extends GuiceDeploymentConfiguration {
@Override
public Module[] createModules() {
return new Module[] { new WinkGuiceModule(), new YourModule() };
}
}
YourModule
只是一个正常的Guice模块。