Oto kod, aby wykonać pewne zadania, zanim aplikacja internetowa jest uruchomiona (używam glassfish4):ostrzeżenie EJB: WELD-000411: ... rozważyć ograniczenie zdarzeń za pomocą @WithAnnotations lub ogólny typ z granicami
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.servlet.ServletContextEvent;
/**
*
* @author Ernestas Gruodis
*/
@Startup
@Singleton
public class ServerInit {
/**
* Do some code execution before web application starts up.
*/
@PostConstruct
public void init() {
System.out.println("Initialising");
}
/**
* Do some code execution on web application exit.
* @param sce the servlet context event.
*/
@PreDestroy
public void destroy(ServletContextEvent sce) {
}
}
Ale podczas uruchamiania mam tych ostrzeżeń:
Weld-000411: metoda Observer [BackedAnnotatedMethod] prywatny org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType (@Observes ProcessAnnotatedType) odbiera zdarzenia dla wszystkich typów z adnotacjami. Zastanów się ograniczając zdarzenia za pomocą @WithAnnotations lub ogólny typ z granicami.
wspawania 000411: Metoda Obserwator [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType (@Observes ProcessAnnotatedType, BeanManager) odbiera zdarzenia dla wszystkich w opis typów. Rozważ ograniczenie zdarzeń za pomocą @WithAnnotations lub typ ogólny z ograniczeniami.
Co jest nie tak?