Expand my Community achievements bar.

SOLVED

service activation

Avatar

Level 4

Hi,

i have a service designed to share its annotation properties. I have 2 global arraylist initialized into the activation of the service (@Activate).

Is there a way to launch the activation method of my service when the bundle starting?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

When you have @component annotation and override activate() method it should automatically initialize when bundle become 'Active' status. 

To make it immediately active when the bundle is deployed, use 

@Component(immediate=true)

View solution in original post

2 Replies

Avatar

Level 10

The method that has the Activate annotation is automatically invoked when you activate your OSGI bundle. Your Array list objects will be initialized.

Avatar

Correct answer by
Level 10

When you have @component annotation and override activate() method it should automatically initialize when bundle become 'Active' status. 

To make it immediately active when the bundle is deployed, use 

@Component(immediate=true)