Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active October 1, 2018 15:29
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save AdamBien/fb7518c9d077c9f8b8dcf771a5b8b196 to your computer and use it in GitHub Desktop.
55thAirhacksQ&A.md
@tonda100
Copy link

Hello Adam,

thank you for doing the airhacks.tv, I have two questions.

  1. Java EE 8 and Jigsaw - is it possible to develop web application with new Java (9, 10, 11)? Is there an example or do I have to wait for Jakarta EE release?
  2. Last episode there were question about LocalDate serialization for JAX-RS and JSON-B the proposed solution was JSONConfigurator class but using ECB design pattern where should I place this class. I would leave in project root package but sometimes there is more of them. Would you create jsonb package or serialization or leave in root?

Thank you,
Antonin

@omega09
Copy link

omega09 commented Sep 30, 2018

Hi Adam,

I have a question about testing/mocking. I created a small and simple project for this: https://github.com/omega09/aTester
A few things to note about it: 1. It's an Eclipse project so it has Eclipse files you can ignore. 2. There are classes in the entities package which are not annotated with JPA because it's not important here. 3. The business logic doesn't make much sense but it's an example. 4. I added a Mockito dependency but you don't have to use it.

I would like you to show how you would write a test for the ActionExecutor.doAction method. I already created a class for this in the test source folder. The test can be whatever you want, I just want to see things like when you use new, when you mock, how you set the injections, how you set up the overall test (populate pre-existing relevant fields), choose a runner, etc.

On the same topic, how relevant is your vid A Note On Java EE Testing today?

Thank you and enjoy the homework assignment :)

@omega09
Copy link

omega09 commented Sep 30, 2018

Another question if you have time, if not I can ask next month.

JavaEE 8 added SSE in JAX-RS 2.1. SseEventSource has reconnection support which tries to resend all missed events, but says

Note however, that this is a best-effort mechanism which does not provide any guaranty that all events would be delivered without a loss. You should therefore not rely on receiving every single event and design your client application code accordingly.

If I want to make sure that all the events were sent, and if not - to send those that weren't, how would you recommend to do that?

@jarryDk
Copy link

jarryDk commented Oct 1, 2018

Dear Adam

avdiu asked "What are your thoughts on Java 9, 10?" - I like to hear about Java 11 and why stop there - that about Java 12 especially JEP 335: Deprecate the Nashorn JavaScript Engine

Thank you,

Michael

@franden
Copy link

franden commented Oct 1, 2018

Hi Adam,

Thank you for your great job (blog, podcast, sessions...). I have a question to your recent post: http://adambien.blog/roller/abien/entry/what_is_dependent_scope

In an ECB/BCE application, the boundary is annotated with @Stateless and all other control instances come as vanilla POJOs without any annotations. They are dependent-objects

that would mean that the complete "web application" would have the same scope like the stateless bean and because the EJBs are pooled resources, all injected CDI beans would be injected and created only once per EJB. This approach can lead to unexpected behavior if you use CDI for instance variable injection because they will not be "reinjected" in this case e.g:

@Stateless
public class SomeRandomService
{
    @Inject
    @ConfigProperty(name = "endpoint.poll.interval")
    private Integer pollInterval;

    @Inject
    @ConfigProperty(name = "endpoint.poll.servername")
    private String pollUrl;

    ...
 }

In such case "pollInterval" and "pollUrl" are injected only once a EJB is created. If the configuration is changed afterwards, already created EJBs SomeRandomService will still use the old values.

To avoid such side effects, all our beans are ether annotated with @RequestScoped (especially on boundary package) or inject objects with getter to retrieve current state.

How do you deal with such problems? Are your really not using @RequestScoped bean in your ECB applications?

@t-shaguy
Copy link

t-shaguy commented Oct 1, 2018

Hello Adam, a big thanks to this awesome gift of invaluable education. Please in trying to deal with the concerns of multiple integrations are ESBs the way to go in an enterprise environment ? Many thanks

@huxendupsel
Copy link

Hello Adam,
short question about the CDI/EJB coexistence inside JEE. Over the last specifications of JEE CDI became more and more powerful. Nowadays you even have the transaction handling on board. So, what do you think about CDI, is it capable of replacing EJBs? Would you recommend the use of CDI over EJBs so you will not have to handle mixed forms, where you have to deal with eventual incompatible context scopes, or is it worth to stick on EJBs to do the job they where designed for?
Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment