我有两个罐A和B,其中A取决于B.
Jar B有一个类:
@ApplicationScoped
public class MyManagedBean {
private String user;
public MyManagedBean(){
//Constructor necesary for CDI
}
@Inject
public MyManagedBean(@Named("user") String user){
this.user = user;
}
...
}
Run Code Online (Sandbox Code Playgroud)
Jar A(更确切地说,一个EJB jar)有一个bean:
@ApplicationScoped
public class AnotherManagedBean {
public AnotherManagedBean(){
//Constructor necesary for CDI
}
@Inject
public AnotherManagedBean(MyManagedBean bean){
...
}
}
Run Code Online (Sandbox Code Playgroud)
以及带有@Produces方法的配置bean:
@ApplicationScoped
public class ConfigurationBean {
public ConfigurationBean(){
//Constructor necesary for CDI
}
@Produces
@Named("user")
public String getUser(){
return "myUser";
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我使用两个Jars部署EAR时,我遇到了这个异常:
SEVERE: Exception while loading the app …Run Code Online (Sandbox Code Playgroud) 我在Postgres数据库中有许多只读表.可以使用任何列组合查询所有这些表.
我该怎么做才能优化查询?向所有表的所有列添加索引是一个好主意吗?
我希望以这种方式注入配置参数:
public class MyManagedBean {
@Inject
public MyManagedBean(@Named("user") String user){
....
}
}
Run Code Online (Sandbox Code Playgroud)
所以我尝试用这种方式实现一个生成器方法:
@ApplicationScoped
public class MyConfiguration {
private Properties loadProperties() {
Properties properties = new Properties();
try {
properties.load(getClass().getResourceAsStream(
"user.properties"));
} catch (IOException e) {
throw new RuntimeException();
}
return properties;
}
@Produces
@Named("user")
String getUser() {
return loadProperties().getProperty("user");
}
}
Run Code Online (Sandbox Code Playgroud)
我有这样定义的其他bean:
public class OtherManagedBean {
@Inject
public OtherManagedBean(MyManagedBean myManagedBean){
....
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试部署它时,我遇到了这个异常:
INFO: WEB0671: Loading application [example-ear#example-war.war] at [example]
SEVERE: Exception while loading the app
SEVERE: …Run Code Online (Sandbox Code Playgroud) 在将 Swift 客户端用于 firebase 时,从 2 月 9 日开始,我开始看到错误消息“请求的快照版本太旧”。在 addSnapshotListener 的回调中。
这个错误是什么意思?
我该如何解决?
谢谢!
我正在尝试更新到最新版本firebase-admin(11.0.0)和firebase-functions(3.21.2)。我用的是firebase-tools11.1.0。尝试部署我的函数时出现此错误:
Error: Failed to load function definition from source: Failed to generate manifest from function source: Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib' is not defined by "exports" in /Users/myuser/Documents/myproject/node_modules/firebase-functions/package.json
Run Code Online (Sandbox Code Playgroud)
我在 StackOverflow 中看到过类似的错误,例如这个或这个,但这个错误略有不同。问题不在于firebase或firebase-admin依赖项,而在于firebase-functions.
使用firebase-functions3.14.1 可以工作(尽管我收到一些警告),但我想更新到最新版本,这样我就有希望摆脱警告并获得最新更新。
我怎样才能解决这个问题?
谢谢!
node-modules firebase package.json google-cloud-functions firebase-admin
我想要一个带有 fullSizeContentView 的 NSWindow 来获取具有内在内容大小的 SwiftUI 视图的确切大小。我看到过类似的帖子,但它们的不同之处在于,在顶层提供一个固定框架就可以了。我不想这样做,我希望窗口大小与视图的大小完全相同。我怎样才能做到这一点?
\n这是在 Xcode 14.1 中运行的 Playground 代码片段。
\nimport AppKit\nimport SwiftUI\n\nclass MyWindow: NSWindow {\n override func setFrame(_ frameRect: NSRect, display flag: Bool) {\n print("\\(Date().timeIntervalSince1970) setFrame called \\(frameRect)")\n super.setFrame(frameRect, display: flag)\n }\n}\n\nlet window = MyWindow()\n\nwindow.styleMask = [\n .titled,\n .closable,\n .resizable,\n .fullSizeContentView\n]\n\nwindow.toolbar = nil\n\nwindow.titlebarAppearsTransparent = true\nwindow.titleVisibility = .hidden\nwindow.isMovable = true\nwindow.isMovableByWindowBackground = true\nwindow.standardWindowButton(.closeButton)?.isHidden = false\nwindow.standardWindowButton(.miniaturizeButton)?.isHidden = true\nwindow.standardWindowButton(.zoomButton)?.isHidden = true\n\nprint("\\(Date().timeIntervalSince1970) Before content \\(window.frame)")\nwindow.contentView = NSHostingView(rootView: ContentView())\nprint("\\(Date().timeIntervalSince1970) After setting content \\(window.frame)")\n\nwindow.makeKeyAndOrderFront(nil)\n\nprint("\\(Date().timeIntervalSince1970) After makeKeyAndOrderFront \\(window.frame)")\n\nDispatchQueue.main.asyncAfter(deadline: .now() + …Run Code Online (Sandbox Code Playgroud) 我在使用长GET请求时遇到此错误:
严重:GRIZZLY0039:请求URI太大.java.nio.BufferOverflowException
我需要为Glassfish 3.1更改哪些配置?
我尝试更改这些参数但没有成功: - header-buffer-length-bytes(通过管理控制台) - request-body-buffer-size-bytes(在domain.xml中)
谢谢.
cdi ×2
firebase ×2
appkit ×1
ear ×1
glassfish ×1
http-get ×1
indexing ×1
jar ×1
java ×1
jboss-weld ×1
named ×1
node-modules ×1
nswindow ×1
optimization ×1
package.json ×1
postgresql ×1
string ×1
swift ×1
swiftui ×1