When to use <optional> true </optional> and when to use <scope> provided </scope>

dependencies decorated with <optional>true</optional>or <scope>provided</scope>will be ignored when they are transitively dependent. I read this , my understanding is like the difference between @Component and @Service in Spring, they only change semantically. Correctly?

+4
source share
1 answer

In addition to the comment, there is a more important semantic difference: it is expected that the "Submitted" dependencies will be provided by the container, so if your container gives you sleep mode, you should mark the sleep mode as provided.

. : 5 , , , , , , . , :

  • , , .

  • : , . .

+3

Source: https://habr.com/ru/post/1659681/


All Articles