Question: I have a date picker where I can select a date range like 3months, 7 days or this year.
How can I select "This year" from a drop down menu?

Here is the code:

```
 <div class="full">
   <div class="range-preset">
    <div class="date-range-selector">
    <label>Date Range:</label>
    <select class="full" style="width:230px; ">
    <option value="custom">Custom</option>
    <option value="yesterday">Yesterday</option>
    <option value="7days">7 Days</option>
    <option value="30days">30 Days</option>
    <option value="90days">90 Days</option>
    <option value="this_month">This Month</option>
    <option value="last_month">Last Month</option>
    <option value="two_months_ago">Two Months Ago</option>
    <option value="this_year">This Year</option>
    <option value="yesterday">Yesterday</option>
    </select>
   </div>
  </div>

```

I tried this:

```
driver.findElement(By.className("full.option.this_year")).click();

```

Any help please, thank you

Answer: 
No spring does not use cloning to create prototype scoped instances.

Below is the code snippet taken from AbstractBeanFactory.doGetBean() function:

```
// Create bean instance.
if (mbd.isSingleton()) {
    sharedInstance = getSingleton(beanName, new ObjectFactory<Object>() {
        @Override
        public Object getObject() throws BeansException {
            try {
                return createBean(beanName, mbd, args);
            }
            catch (BeansException ex) {
                // Explicitly remove instance from singleton cache: It might have been put there
                // eagerly by the creation process, to allow for circular reference resolution.
                // Also remove any beans that received a temporary reference to the bean.
                destroySingleton(beanName);
                throw ex;
            }
        }
    });
    bean = getObjectForBeanInstance(sharedInstance, name, beanName, mbd);
}

else if (mbd.isPrototype()) {
    // It's a prototype -> create a new instance.
    Object prototypeInstance = null;
    try {
        beforePrototypeCreation(beanName);
        prototypeInstance = createBean(beanName, mbd, args);
    }
    finally {
        afterPrototypeCreation(beanName);
    }
    bean = getObjectForBeanInstance(prototypeInstance, name, beanName, mbd);
}

```

The createBean method call boils down to below code:

```
BeanUtils.instantiateClass(constructorToUse);

```
I have not dug into Spring source code, but I think Beans with `prototype` scope in Spring are not created using `clone()` method because it is not mandatory to implement the `Cloneable` interface for those beans.

Moreover, suppose it is creating them using `clone()`. It would then be dangerous if someone is expecting deep copy instead of shallow copy.

You can always test it and find the answer.