New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When to use BeanDefinition.SCOPE_PROTOTYPE vs. ConfigurableBeanFactory.SCOPE_PROTOTYPE [SPR-15342] #19905
Comments
I also analyzed javadoc/api. I found that This information is available in @sbrannen , is this information enough or is it worth starting a PR? |
Since the In addition, all that really matters is that the Please keep in mind that When working programmatically with bean definitions, one may prefer to reference the In any case, I'll tidy up our internal use of those constants for greater consistency. |
As a side note, it's also possible to create your own custom "prototype" scope annotation as follows. @Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public @interface Prototype {
} or @Target({ ElementType.TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public @interface PrototypeScope {
} |
Manuel Jordan opened SPR-15342 and commented
Hello Spring team
I have tested that these three ways are valid:
Of course the first is the most obvious, but about the other two ways: I did a research through the javadoc/api and current Reference Documentation for these two interfaces and there is no mention about when an approach should be used over the other.
Even when it is trivial I think is fair give some indication.
Affects: 4.3 GA, 4.3.6
The text was updated successfully, but these errors were encountered: