java - lambda expression prevents class from spring component-scan -
our application have class test @component annotation. lambda expression being used here.
@component public class test{ private scheduledexecutorservice schedulerexecutorservice; private long timeoutforrollback=180000; private long timeoutfailoverdelay=180000; public static test getinstance() { if (instance == null) { /*actual instance created via reflection. using new understanding */ instance = new test(); } return instance; } public void handlefailover(){ schedulerexecutorservice.schedulewithfixeddelay( () -> { schedulerexecutorservice.shutdown(); }, timeoutforrollback, timeoutfailoverdelay, timeunit.milliseconds); } }
but test class bean not created. when method commented, test class bean created.
using java 8 oracle , eclipse neon2.
suggest if changes needed fix this.
edit 1:
found similar issue reported: https://java.net/jira/browse/javaserverfaces-3732
edit 2:
similar issue faced https://github.com/orfjackal/retrolambda/issues/121
p.s:
if
() -> { schedulerexecutorservice.shutdown(); }
is replaced private innerclass, working fine.
private class terminalscheduledexecutor implements runnable{ @override public void run() { schedulerexecutorservice.shutdown(); } }.
however looking forward solutions without replacing lambda functions.
have tried change spring framework's logging level detailed bean creation logs?
per suggestion here: question no answers, issue solved in comments (or extended in chat)
Comments
Post a Comment