How can I create a new annotation?

java, spring

Solution

You can create your own annotation (e.g. `@MyComponent`) annotated with the corresponding spring annotation. For example:

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Component
public @interface MyComponent {
}

Problem

How can I create a new annotation based on a Spring `@Service` annotation or `@Component`? I want just to change the name for a more semantic use: for example change the name to `@TransactionelService`.

Original source