How to customize IntelliJ provided values in my own annotations

Viewed 105

I'm studying Spring and when I use the Scope annotation for a class, IntelliJ helps me providing different options for value property (String), example

How can I develop my own annotation to predefine those values?

Also for the @Value annotation, where does IntelliJ get the values from? or is it just a "sharpening" for Spring?

Edit: This is meant specifically for annotations. In general, on the left as suggested in Spring, on the right is my class. How to do as on the left?

Example for edit

package ru.max.mypacktest;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface MyRealName {
    
    String value() default "";

}
1 Answers

Looks like there is no default way to configure it but you can try using Live Templates feature as a workaround.

  • Create the following Live Template:

    enter image description here

    enter image description here

  • Call it in your code:

    enter image description here

Related