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: 
Spring does not use the Prototype Pattern, it uses reflection. 
Plus, in order to use clone() it would have to subclass somehow a bean, because clone() is protected, so it does not use clone() either. 

Here is a code fragment from 

```
org.springframework.beans.factory.support.SimpleInstantiationStrategy

```

where you can see the use of java.lang.reflect.Constructor and java.lang.Class reflection method:

```
public Object instantiate(RootBeanDefinition beanDefinition, String beanName, BeanFactory owner) {

    if (beanDefinition.getMethodOverrides().isEmpty()) {
        Constructor<?> constructorToUse;
        synchronized (beanDefinition.constructorArgumentLock) {
            constructorToUse = (Constructor<?>) beanDefinition.resolvedConstructorOrFactoryMethod;
                    ...
                        constructorToUse =  clazz.getDeclaredConstructor((Class[]) null);
                    ...
                }
                ...

    }
    ...
}

```

So the term prototype is used to suggest that at every call to getBean, you'll get a new instance with the same properties. This is more than a simple call to a constructor however, because you'll get a bean with all dependencies wired and other properties set, so in a sense it is a prototype. Or at least it fits the concept very well.
No. Spring scopes such as **prototype** or **singletone** do not follow strictly design patterns. The naming of scopes was used to intuitively suggest behavior container provides.

This way you can have a "singleton" pattern within the container and create another object outside of the container. Similarly "prototype" pattern does not have to implement "clone" functionality.

You may want to look into this link as well:   
 [Singleton design pattern vs Singleton beans in Spring container](https://stackoverflow.com/questions/2637864/singleton-design-pattern-vs-singleton-beans-in-spring-container)

More elaborate explanations here:   

<https://springframework.guru/gang-of-four-design-patterns/prototype-pattern/>