Q:

Spring's autowiring , new operator and confusion

I have class called Engine, and a Car. 
class Engine {

...some params
...getters
...setters

}

class Car extends Engine {

... some params
... getters 
... setters

}

Now in a controller say there is a endpoint called "./getCarDetails"
There is a table which corresponds to Engine class called engines. 
Now since for carDetails i need engine and some other params, i am using engineRepository for getting engine table's data and otherRepository from some other details data. 
What i did was i made Engine class a component and autowired it.  Now i have engine bean , i am setting the engine values for each cars. 
for eg. 
@Autowired
Engine engine;

for(Car car: cars){
 car.setEngineParam(engine.getEngineParam());
}

The problem :-
Each car has the same engine
But when i create the object using new operator, everything works fine. 
Question:-

Should i never use new operator in spring boot app ? 
How do i solve the current problem without new operator using
  autowiring ? 

A:

The engine is the same because the default scope is SINGLETON. 
You can use PROTOTYPE scope to get a new bean each time it is requested from the container.  You'll also need proxy because you are autowiring it in a controller and not explicitly requesting from the container.  So annotate your engine class with this:-
@Scope(value="prototype", proxyMode=ScopedProxyMode. TARGET_CLASS)

