我想知道这些方法之间的区别.
当使用EntityManager 的createQuery()和find()方法时?
他们每个人的优势是什么?
谢谢你的回答.
如果有人在此代码中使用http://oauth.googlecode.com/svn/code/java/core/和示例服务器的经验,也许您可以向我解释如何实现Authenticated Requests处理?参考:http://tools.ietf.org/html/rfc5849#section-3
因此,当用户通过身份验证并且受保护的资源服务器只想确认针对OAuth提供程序的真实性时.
尝试查找用户使用方法时遇到问题findUser.我创建了一个窗口"登录"以在我的应用程序中连接,当我点击"连接"按钮时,会显示以下错误:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.alstom.ems2.application.login.connectionActionPerformed(login.java:127)
at com.alstom.ems2.application.login.access$100(login.java:16)
at com.alstom.ems2.application.login$2.actionPerformed(login.java:61)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
at java.awt.EventQueue.access$200(EventQueue.java:103)
at java.awt.EventQueue$3.run(EventQueue.java:688)
at java.awt.EventQueue$3.run(EventQueue.java:686)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:702)
at java.awt.EventQueue$4.run(EventQueue.java:700)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) …Run Code Online (Sandbox Code Playgroud) 我怀疑由ServiceManager注册的服务而不是由SystemServiceRegistry注册的服务。
/**
* Manages all of the system services that can be returned by {@link Context#getSystemService}.
* Used by {@link ContextImpl}.
*/
Run Code Online (Sandbox Code Playgroud)
这意味着可以从上下文中获取由System注册的服务。
关于ServiceManager,如何访问未由SystemServiceRegistry注册的应用程序中由ServiceManager添加的服务?