private Last60MinutesArray last60MinutesOfBytes = new Last60MinutesArray();
@Bean
Last60MinutesArray last60MinutesOfBytes()
{
return last60MinutesOfBytes;
}
private Last60MinutesArray last60MinutesOfStartedTrackersCount = new Last60MinutesArray();
@Bean
Last60MinutesArray last60MinutesOfStartedTrackersCount()
{
return last60MinutesOfStartedTrackersCount;
}
@Bean
InLast60MinutesChart bytesUploadedInLastMinutesChart()
{
return new InLast60MinutesChart("Bytes Uploaded"
,last60MinutesOfBytes);
}
@Bean
InLast60MinutesChart uploadsStartedInLastMinutesChart()
{
return new InLast60MinutesChart("Uploads Started"
,last60MinutesOfStartedTrackersCount);
}
I'm creating two beans of type InLast60MinutesChart
which takes a Last60MinutesArray
in the constructor. I rather not have 'Last60MinutesArray' brought in through the constructor but rather instantiated in the InLast60MinutesChart
. However, I still want two separate instances of 'Last60MinutesArray' and I want them both to be Beans so I can use springs annotations such as @Scheduled.
Thanks for any thoughts :)
I want it to look something like this:
@Bean
InLast60MinutesChart bytesUploadedInLastMinutesChart()
{
return new InLast60MinutesChart("Bytes Uploaded");
}
@Bean
InLast60MinutesChart uploadsStartedInLastMinutesChart()
{
return new InLast60MinutesChart("Uploads Started");
}
public class InLast60MinutesChart
{
@Autowired
protected Last60MinutesArray last60MinutesArray;
}
And I want each InLast60MinutesChart
to have its own distinct Last60MinutesArray
and lets also say I want 50 instances of InLast60MinutesChart
and so I don't really want to create a Bean for each Last60MinutesArray
. I have to create a Bean for each InLast60MinutesChart
but I'd rather not create that many Last60MinutesArray
Beans on top of that along with any other Beans I want to add to the InLast60MinutesChart
Bean. Kind of weird scenario but I hope if gets my question across.