简体   繁体   中英

start application (from jar) on Weblogic startup

I'm using Weblogic 12c, I need to run app before/with the web app starts. the app should fetch information and write it to db. I read that in previous versions of WL programmers used to work with ApplicationLifecycleListener, but it is deprecated now.

I'm compiling the project to ear file. I also tried to use ejb3.2 eager singleton, but it didn't worked.

Is there any working alternative?

I solved the issue by creating EJB as the following:

@Singleton
@Startup
public class StartupBean {

@PostConstruct
private void startup() { ... }

@PreDestroy
private void shutdown() { ... }
...
}

Creating the EJB Singleton instances is one of the Weblogic life cycle init calls, I put my java code under startup() method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM