Create prototype scoped Spring bean with annotations?

You can use the @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE) annotation.

@Service
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public class CustomerService {
    // ...
}
  1. Spring API Docs.
  2. Example of the mapping.
  3. Scope annotation reference.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)