SpringBoot app fails while trying to initialize this class:
@Component
public class Weather {
private Map<Integer,Double> maxRainyDays;
private Map<Integer, WeatherDays> totalDays;
public Weather(Map<Integer, WeatherDays> totalDays, Map<Integer,Double> maxRainyDays){
this.setMaxRainyDays(maxRainyDays);
this.setTotalDays(totalDays);
}
The error:
Parameter 0 of constructor in SolarSystem.Models.Weather required a bean of type 'SolarSystem.Utilities.WeatherDays' that could not be found.
The mentioned bean is already defined (in the same basepackage):
public enum WeatherDays {
RAINY,
MILD,
DRY,
MAX_RAIN}
Workaround:
When I changed to Weather() constructor I solved the issue.Of course I had to use setters to set the properties of the object.
But I need to understand the reasons why happened