Skip to content

Instantly share code, notes, and snippets.

@AdamBien
Last active October 14, 2017 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdamBien/ec94900a3efd5d621bf4f00cc8a0dbac to your computer and use it in GitHub Desktop.
Save AdamBien/ec94900a3efd5d621bf4f00cc8a0dbac to your computer and use it in GitHub Desktop.
43rdAirhacksQ&A.md
@victorroeder
Copy link

Hey Adam,

I have a question regarding qualifier instantiation for CDI.current().select(....)

Given the following qualifier (MyQualifier):

@Qualifier
@Target({TYPE, METHOD, PARAMETER, FIELD})
@Retention(RUNTIME)
public @interface MyQualifier {
     String value() default "";
}

Now, to be able to instantiate it to use it along with CDI.current().select() (or Instance.select()), there are two ways:

1.) Letting the annotation class inherit from AnnotationLiteral. Example:

public class MyQualifierLiteral extends AnnotationLiteral<MyQualifier> implements MyQualifier {

    String value = "";

    public MyQualifierLiteral(String value) {
        this.value = value;
    }

   @Override
    public String value() {
        return value;
    }
}

2.) Directly implement the qualifier interface (without extension of AnnotationLiteral). Example:

public class MyQualifierInstance implements MyQualifier {

    String value = "";

    public MyQualifierLiteral(String value) {
        this.value = value;
    }

   @Override
    public String value() {
        return value;
    }

    @Override
    public Class<? extends Annotation> annotationType() {
        return MyQualifier.class;
    }
}

Now both can be used the same way:

With the Literal class:

MyQualifiedImplementation a = myImplementations.select(new MyQualifierLiteral("hello"));

or with the Instance class:

MyQualifiedImplementation a = myImplementations.select(new MyQualifierInstance("hello"));

What is the difference between them? Is there a reasonable one?

Many many thanks!

Victor

@bilelovitch
Copy link

Dear Adam,

I have a question about security in Java EE applications, in fact we are currently limited to securing only the web pages, so the security of the data is linked to the role (because each role = well defined pages) and no control is performed before the loading of the data. For me this means, that we are just securing the access to the application and not the access to the data.

My question is what is the best approach to secure access to the data of a Java EE application ?

In an another application that contains sensitive data, the client wants to encrypt the data at the database level, for that we have used a listener (javax.persistence.PostPersist; javax.persistence.PostLoad; javax.persistence.PostUpdate;) for the control but it failed. According to you what is the best approach to encrypt and decrypted the data with a Java EE application ?

@danilopiazza
Copy link

Hi Adam,

In the WebStandards Igniter online workshop (which I strongly recommend!), you have been using bind in JavaScript functions passed to event handlers.

What is the difference between bind and the widely used var self = this pattern? Which one is preferred?

@dempile
Copy link

dempile commented Oct 9, 2017

Hi Adam,
1- From the definition a microservices must be independent and autonom, so is that means that he must carry the database with him? if Yes how we could manage such situation.
2- Do you think JEE 8 can be used in production ?

thanks

@j-ibarra
Copy link

j-ibarra commented Oct 9, 2017

Hi Adam
which is the best method for microservices for endpoints in different docker containers, using a proxy as nginx or point to different ports, for when a course on vimeo ondeman Jenkins + java 9 + java EE 8

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