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
@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
//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
@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
@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
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
@ApplicationScoped | |
public class AsyncObserver | |
{ | |
public void onEvent(@ObservesAsynchronous MyEvent event) | |
{ | |
//... | |
} | |
} |
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
@RunWith(CdiTestRunner.class) | |
public class MockitoMockedCdiBeanTest | |
{ | |
@Inject | |
private MyCdiBean myCdiBean; | |
@Inject | |
private DynamicMockContext mockContext; | |
@Test |
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
@RequestScoped | |
public class MyCdiBean | |
{ | |
private int count = 0; | |
public int getCount() | |
{ | |
return count; | |
} |