This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DefaultEventBroadcastingTest | |
{ | |
@Inject | |
private AsynchronousEvent<MyEvent> myAsyncEvent; | |
public void fireAsyncEvent() | |
{ | |
this.myAsyncEvent.fire(new MyEvent(/*...*/)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SessionScoped | |
@JsfPhaseListener | |
public class WindowQuotaHandler implements PhaseListener | |
{ | |
@Inject | |
private WindowContext windowContext; | |
private Stack<String> windowIdStack = new Stack<String>(); | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@PartialBeanBinding | |
@Retention(RUNTIME) | |
@Target(TYPE) | |
public @interface TypeSafeConfig { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//example #1 for a custom type-safe config | |
@TypeSafeConfig | |
public interface AppConfig { | |
String name(); | |
ApplicationVersion version(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TypeSafeConfig | |
public interface AppConfig2 { | |
String name(); | |
@Produces //since ds v1.5.1 | |
ApplicationVersion version(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@TypeSafeConfig | |
public interface AppConfig { | |
String name(); | |
ApplicationVersion version(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//add the fully qualified class name to META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource | |
public class CustomKeyFormatAwareConfigSource implements ConfigSource { | |
private final static int ordinal = 1000; | |
@Override | |
public int getOrdinal() { | |
return ordinal; | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MultiProfileExtension implements Extension { | |
private Set<String> activeProfileNames = new HashSet<>(); | |
protected void determineActiveProfiles(@Observes BeforeBeanDiscovery beforeBeanDiscovery) { | |
String activeProfileString = | |
ConfigResolver.getPropertyValue("active-profiles", "Production"); | |
Collections.addAll(activeProfileNames, activeProfileString.split(",")); | |
} | |
protected void matchActiveProfiles(@Observes ProcessAnnotatedType pat, BeanManager bm) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Profile("X") | |
//further cdi annotation/s | |
public class BeanProfileX { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ProfileA | |
//further cdi-annotation/s | |
public class BeanProfileA { | |
} |