I created a simple rest service using java, and springboot. here is my service layer code
@Service
class MyService {
private final TestService service;
@Autowired
public MyService(final TestService service) {
this.service = service;
}
// here is the issue
private final Predicate<User> userPredicate = (user) -> this.service.isValidUser(user);
}
In the above line, the ide complaining about the variable service might not be initialized, and I can not use it in the predicate implementation. I tried removing final to the service, that works, but I do not want to remove final to the TestService declaration.
Anyone have any solution ?