Gerhard Petracek created DELTASPIKE-1003:
--------------------------------------------
Summary: support @Produces in partial-beans
Key: DELTASPIKE-1003
URL: https://issues.apache.org/jira/browse/DELTASPIKE-1003
Project: DeltaSpike
Issue Type: New Feature
Components: PartialBean
Affects Versions: 1.5.0
Reporter: Gerhard Petracek
Assignee: Gerhard Petracek
Fix For: 1.5.1
it allows to use partial-bean methods also as simple producers of (qualified)
types. the main use-case is about exposing injectable values without additional
producer-classes since partial-beans are mainly about exposing values (and
invoking generic-methods) easily. implication: we don't need to support
disposer-methods for now.
example:
{code}
@TypeSafeConfig //partial-bean binding
public interface Config
{
@Produces
@ApplicationName //custom
String name();
String version();
}
//+ handler
{code}
that allows to inject Config and access the methods or just inject a string
qualified with @ApplicationName. -> it's mainly a shortcut similar to producers
based on BaseConfigPropertyProducer.
a version based on BaseConfigPropertyProducer would look like:
{code}
public class ConfigProducer extends BaseConfigPropertyProducer
{
@Produces
@ApplicationName
public String applicationName(InjectionPoint injectionPoint)
{
return getStringPropertyValue(injectionPoint);
}
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)