gpt4 book ai didi

jboss - SEAM中bean初始化链末端如何调用startup bean

转载 作者:行者123 更新时间:2023-12-05 01:14:54 30 4
gpt4 key购买 nike

14:00:04,449 INFO  [org.jboss.seam.servlet.SeamFilter] Initializing filter:
org.jboss.seam.servlet.characterEncodingFilter
14:00:04,450 INFO [org.jboss.seam.servlet.SeamFilter] Initializing filter:
org.jboss.seam.web.redirectFilter
14:00:04,451 INFO [org.jboss.seam.servlet.SeamFilter] Initializing filter:
org.jboss.seam.web.exceptionFilter
14:00:04,452 INFO [org.jboss.seam.servlet.SeamFilter] Initializing filter:
org.jboss.seam.web.multipartFilter
14:00:04,452 INFO [org.jboss.seam.servlet.SeamFilter] Initializing filter:
org.jboss.seam.web.identityFilter
14:00:04,453 INFO [org.jboss.seam.servlet.SeamFilter] Initializing filter:
org.jboss.seam.web.rewriteFilter

这些是在 JBoss 6 上启动 JBoss SEAM 应用程序后打印的最后一组行。

@Name("myStartup")
@Startup
@Scope(APPLICATION)
@BypassInterceptors
public class MyStartup {

@Create
public void create() {
System.out.println("SERVER STARTED SUCCESSFULLY");
}
}

我的意图是在 SeamFilter 初始化后打印上述消息(在 JBoss 6 控制台上)。我应该怎么做?

最佳答案

你可以在一个普通的组件上试试这个注解。删除此组件上的 @Startup

@Observer({"org.jboss.seam.postInitialization", "org.jboss.seam.postReInitialization"})
public void create() {
System.out.println("SERVER STARTED SUCCESSFULLY");
}

关于jboss - SEAM中bean初始化链末端如何调用startup bean,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6451622/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com