Java – parsing of external (third-party) beans

I know it's still not very popular because the specification was released a few months ago

I haven't "installed" welding yet. I'm just reading. Through this question, I want to make sure that I understand this important point is correct:

Solve the problem of beans in third-party cans by declaring them as < alternative > In your beans In XML?

If not, how to use beans Beans in third-party libraries of XML?

Putting jars on the classpath won't work unless they have beans in their meta - inf XML, which cannot be implemented for third-party jars (see Gavin King's post on the subject)

Solution

Why is it so complicated?

Just create a producer method for the third-party course

Suppose you have a third-party library that automatically obtains PDF files and sends them by fax. You like to use images

private @Inject PdfFaxService faxService;

In your code, you can simply provide a generator method for it Pdffaxservice works stateless, so we can safely assume that we can make it @ applicationscope:

public @Produces @ApplicationScoped PdfFaxService createFaxService() {
  return new PdfFaxService(initparameters);
}

Somewhere

heart linked to heart.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>