@SpringBootApplication
@RestController
public class TestSpringbootApplication {
@Value("${book.author}")
private String bookAuthor;
@Value("${book.name}")
private String bookName;
@RequestMapping("/")
String index() {
return "book name is:" + bookName + " and book author is:" + bookAuthor;
}
public static void main(String[] args) {
//SpringApplication.run(TestSpringbootApplication.class, args);
//注解
SpringBootApplication a=TestSpringbootApplication.class.getAnnotation(SpringBootApplication.class);
//获取注解的注解
a.annotationType().getAnnotations();
a.annotationType().getAnnotation(SpringBootConfiguration.class)
获取注解的注解的方法的注解
System.out.println(a.annotationType().getDeclaredMethod("scanBasePackages").getAnnotation(AliasFor.class));
}
}