Enum Class Around.ProxyTargetConstructorMode
- Enclosing class:
Factorymethod if the returned bean features constructor arguments this can lead to undefined behaviour since it is expected with factory methods that the developer is responsible for constructing the object.
For example if the type accepts an argument of type
String then there is no way
for Micronaut to know what to inject as a value for the argument and injecting
null is inherently unsafe.
Around.ProxyTargetConstructorMode allows the developer decide if they wish to allow
proxies to be constructed and if a proxy is allowed then Micronaut will either inject a bean if it is found or
null if is not. For primitive types Micronaut will inject
true for booleans and
0 for number types
Nested Class Summary
Enum Constant Summary
Method SummaryModifier and TypeMethodDescriptionReturns the enum constant of this class with the specified name.
values()Returns an array containing the constants of this enum class, in the order they are declared.
Methods inherited from class java.lang.Enum
clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
Enum Constant Details
ERRORpublic static final Around.ProxyTargetConstructorMode ERRORDo not allow types with constructor arguments to be proxied. This is the default behaviour and compilation will fail.
WARNpublic static final Around.ProxyTargetConstructorMode WARNAllow types to be proxied but print a warning when this feature is used.
In this case if a constructor parameter cannot be injected Micronaut will inject
nullfor objects or
falsefor boolean or
0for any other primitive.
ALLOWpublic static final Around.ProxyTargetConstructorMode ALLOWAllow types to be proxied and don't print any warnings.
valuespublic static Around.ProxyTargetConstructorMode values()Returns an array containing the constants of this enum class, in the order they are declared.
- an array containing the constants of this enum class, in the order they are declared
valueOfReturns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)