Startup bean not called

前端 未结 4 1585
情深已故
情深已故 2021-02-09 21:00

I created a Java Web Application Project in NetBeans, and created a startup bean in it:

package malibu.util;

import javax.annotation.PostConstruct;
import javax         


        
4条回答
  •  盖世英雄少女心
    2021-02-09 21:04

    Try the following set of annotations:

    @Singleton
    @Startup
    public class Startup {
        @EJB
        private ProviderEJB providerEJB;
    
        @PostConstruct
        public void onStartup() {
            System.err.println("Initialization success.");
        }
    }
    

    You will find more details here and in this book (chapter 2).

提交回复
热议问题