Win a copy of Java Challengers this week in the Java in General forum!

NoName Human

Greenhorn
+ Follow
since Nov 01, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by NoName Human

Hello all
So I was looking at this example showing how to lazy load TreeView.
Just to save a click, this is the code:



I am working on trying to convert this code to a separate complete class in itself. Something like:



This should create a treeview with filesystem structure.

So far my attempt is this (incomplete):




I am stuck (at the comment in my code). In original code, the method basically calls itself for every new file. But I can't do that with class, cant call that class within the same class.

So it would help if someone could atleast guide me a little on how to go about here.
5 years ago
Hey all

I am new to Spring and learning the DI. I have three simple classes for an experiment.

Class1:



Class2:



Class3:



Beans.xml:



But as pointed in code, it keeps giving me NPE. Even using @Autowired in Class3 gives error. Please suggest what am I doing wrong?

EDIT:

If I dont set the scope to be prototype, it works fine. Else it doesn't.
But I need the scope to be prototype since I want this bean to have a new instance everytime its launched (I am calling it using a button click. But I did not include that code for sake of simplification).
5 years ago