Questions tagged [postconstruct]

@PostConstruct is a Java EE annotation used to select a method that needs to be executed after dependency injection is done to perform any initialization.

The @PostConstruct annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization. This method MUST be invoked before the class is put into service.

This annotation is recognized by all Java EE compliant containers as well as .

See also

242 questions
0
votes
1 answer

JSF selectOneMenu

I am new in JSF and facing problem in getting the drop down list. I don't want to use the @PostConstructor. I tried couple of sources on google but i don't know where i am making the mistake. please hep me out. Managed Bean package…
Naveen
  • 31
  • 1
  • 6
0
votes
1 answer

@PostConstruct not invoked in PhaseListener

I am using jsf2.2 with wildfly 8.1 and javaee7. My CDI bean injection in the phaselistener works as expected, but the @PostConstuct method is never invocked I have tried to annotate the phaselistener with @javax.enterprise.context.ApplicationScope,…
maress
  • 3,533
  • 1
  • 19
  • 37
0
votes
0 answers

Translate methods @PostConstruct of Java EE toward Spring

I have decided to migrate an application in the architecture JPA-EJB-JSF toward JPA-Spring-JSF. During this migration to spring I have enabled CDI also. After the migration of all the layers I am at the level of the layer of the controllers. In Java…
0
votes
1 answer

Grails unit test fails on @PostConstruct

Have a @PostConstruct in the service to ensure that the dependencies have been set up. Dependencies are set in resources.groovy. Unit test fails on @PostConstruct asserts. Tried setting up the dependencies manually in setUpSpec to no avail. Even…
Abhijit Sarkar
  • 21,927
  • 20
  • 110
  • 219
0
votes
1 answer

viewscoped bean is called on every access of back bean

I'm trying to create a bean using the view scope but the @PostConstruct function is called on every access of the bean. Here is a very simple example (.xhtml):
0
votes
0 answers

@PostConstruct is loading beans using Hiberante, but JSF is not showing them in dataTable?

So @PostConstruct init function is working correctly, I've tested it with System.println() but JSF is still not showing any information. Any suggestions how to fix this or how to do it the other way? EventBean @PostConstruct public void init() { …
ralic
  • 75
  • 1
  • 3
  • 10
0
votes
1 answer

java.lang.IllegalArgumentException: Der Rückgabetyp der Lebenszyklusmethode [init] muss "void" sein

I am creating a java/jsf web application in NetBeans using by GlassFish Server. When I try to deploy the application, it failed and getting the following error: GlassFish Server 4, deploy, null,…
Amin
  • 1
  • 1
0
votes
0 answers

@PostConstruct data becomes null

I'm using primefaces. I have data in p:datatable. I'm editing a row in a dialog. When I do it fast (in less than 40 seconds) everything is OK (i can save the data) but if I edit the data for some time all the data in the bean (manegedBean,…
TajnosAgentos
  • 167
  • 1
  • 1
  • 10
0
votes
1 answer

@PostConstruct method init() is never invoked on a ManagedBean

I'm still a beginner at JSF programming and I'm trying to do a little example to understand how it works. I'm facing the problem where the @PostConstruct method of a managed bean is never invoked (the instanciations in it are never made, and the…
Job
  • 1
  • 1
0
votes
0 answers

JSF - fields not initialized at @PostConstruct

Hellow I am trying to load a jsf page depending on a parameter I pass from a previous page. I am passing the parameter in the url and trying to read it in the @PostConstruct method of the second page's managed bean to determine what to display in…
0
votes
1 answer

Primefaces Picklist is always empty when using Postconstruct

My code below doesn't work, I'm using primefaces picklist and postconstruct annotation to init method with try catch block. However my picklistbean is empty, I tried all the ways to make it work but none of them worked. Can anyone provide me working…
Burak
  • 13
  • 1
  • 3
  • 11
0
votes
1 answer

Spring Roo @PostConstruct not being called

I have the following config file:
dleerob
  • 4,951
  • 4
  • 24
  • 36
0
votes
1 answer

Post Construct is not called

I wrote a managed bean with post construct method (using @PostContruct), but the method is not being called. I'm using liferay liferay-portal-6.1.2-ce-ga3 with Jboss 7.1.1, and Icefaces 3.0. Can someone help me figure this out? @SessionScoped …
gu3rr3ro
  • 16
  • 1
  • 5
0
votes
1 answer

Calling JSNI method in @PostConstruct - Errai

I'm having an issue trying to call a JS function from Java using Errai 2.3.2 I'm using Bootstrap switch and I need to invoke a JS function in order to activate it. I need to do this after the page is created and all the elements are attached to the…
cristianmiranda
  • 130
  • 2
  • 11
0
votes
1 answer

Initialize model values on initial request only and not on postback request

I have a managedbean AddDeviceBean where in instantiating all domain objects used in screen in the constructor public AddDeviceBean() { device = new DeviceVO(); deviceacct = new DeviceAccountsVO(); deviceconfig = new DeviceConfigVO(); …
user2462959
  • 75
  • 11