Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[sisu-users] Should I be able to use @PostConstruct on an abstract class?

The PostConstruct is not called. I'm using 0.2.M2

@Named
public abstract class AbstractWsBusComponent implements WsBusComponent {
    @Inject
    protected MetricRegistry metrics;
    private Timer requests;

    @PostConstruct
    public void postConstruct() {
        requests = metrics.timer(name(getClass(), "requests"));
    }


    @Override
    public final Text process(WsBusComponentInput input) {
        Timer.Context context = requests.time();
        try {
            return processImplementation(input);
        } finally {
            context.stop();
        }
    }

    protected abstract Text processImplementation(WsBusComponentInput input);
}

Back to the top