Weather Forecast


Java Spring Components Public New

Hard 

5min


Consider the following two classes:

@Service
public class WeatherForecastService {

    private Thermometer thermometer;

    @Autowired
    public WeatherForecastService(Thermometer thermometer) {
        this.thermometer = thermometer;
    }

    @Scheduled(fixedDelay = 10000)
    public void takeTemperatureMeasurement() {
        thermometer.measure();
    }   
}

@Component
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class FakeThermometer implements Thermometer {

    @Override
    public int measure() { return 10; };
}

Supposing Spring uses component scanning to discover beans, select all of the statements that are correct.