all I want to do is autowire the field backgroundGray in the NotesPanel class, but all I get is the exception below.
So, question is, how to autowire it correctly ? It r
The problem is here:
frame.add(new NotesPanel(), BorderLayout.CENTER);
you are creating a new object for class NotesPanel in the constructor of class Notepad.
The constructor is called before method main, so Spring context has not been loaded yet.
When instantiating the object for NotesPanel, it can't auto wire BackgroundGray because Spring context doesn't exists at that moment.