2

Like described in Set findbugs NotNull as default for all classes under a package I annotated my packages so all class fields are automatically marked as @NonNull.

Now are all the @Autowired not nullable, too, which leads to many FindBugs errors that these fields are not initialized. Is there a config to tell FindBugs that all fields should be @NonNull except @Autowired fields?

Community
  • 1
  • 1
mibutec
  • 2,929
  • 6
  • 27
  • 39
  • could you attach a code snipped, an mark the errors? – duffy356 Apr 16 '15 at 19:24
  • @ NotNull doesn't automatically make sure that fields are not null, you still have to do it. From what it sounds like, your @Autowired is not triggering, hence the variable doesn't get initialized. Either your class is not annotated with @ Service / @ Component, your applicationContext.xml doesn't have annotatation scanning enabled or might be incorrectly setup. Please post some code snippets, especially your applicationContext.xml and your java class. – Jan Vladimir Mostert Apr 16 '15 at 19:44

0 Answers0