一句话获取spring下所有注解

引入依赖包

<dependency>
    <groupId>org.reflections</groupId>
    <artifactId>reflections</artifactId>
    <version>0.9.11</version>
</dependency>

编写如下java代码:

import org.reflections.Reflections;

import java.lang.annotation.Annotation;


public class Main {
    public static void main(String[] args) {
        new Reflections("org.springframework")
                .getSubTypesOf(Annotation.class)
                .stream()
                .map(clazz->clazz.getName())
                .sorted()
                .forEach(System.out::println);
    }
}

即可打印出所有的注解

org.springframework.beans.factory.annotation.Autowired
org.springframework.beans.factory.annotation.Configurable
org.springframework.beans.factory.annotation.Lookup
org.springframework.beans.factory.annotation.Qualifier
org.springframework.beans.factory.annotation.Required
org.springframework.beans.factory.annotation.Value
org.springframework.cache.annotation.CacheConfig
org.springframework.cache.annotation.CacheEvict
org.springframework.cache.annotation.CachePut
org.springframework.cache.annotation.Cacheable
org.springframework.cache.annotation.Caching
org.springframework.cache.annotation.EnableCaching
org.springframework.context.annotation.Bean
org.springframework.context.annotation.ComponentScan
org.springframework.context.annotation.ComponentScan$Filter
org.springframework.context.annotation.ComponentScans
org.springframework.context.annotation.Conditional
org.springframework.context.annotation.Configuration
org.springframework.context.annotation.DependsOn
org.springframework.context.annotation.Description
org.springframework.context.annotation.EnableAspectJAutoProxy
org.springframework.context.annotation.EnableLoadTimeWeaving
org.springframework.context.annotation.EnableMBeanExport
org.springframework.context.annotation.Import
org.springframework.context.annotation.ImportResource
org.springframework.context.annotation.Lazy
org.springframework.context.annotation.Primary
org.springframework.context.annotation.Profile
org.springframework.context.annotation.PropertySource
org.springframework.context.annotation.PropertySources
org.springframework.context.annotation.Role
org.springframework.context.annotation.Scope
org.springframework.context.event.EventListener
org.springframework.core.annotation.AliasFor
org.springframework.core.annotation.Order
org.springframework.format.annotation.DateTimeFormat
org.springframework.format.annotation.NumberFormat
org.springframework.jmx.export.annotation.ManagedAttribute
org.springframework.jmx.export.annotation.ManagedMetric
org.springframework.jmx.export.annotation.ManagedNotification
org.springframework.jmx.export.annotation.ManagedNotifications
org.springframework.jmx.export.annotation.ManagedOperation
org.springframework.jmx.export.annotation.ManagedOperationParameter
org.springframework.jmx.export.annotation.ManagedOperationParameters
org.springframework.jmx.export.annotation.ManagedResource
org.springframework.lang.NonNull
org.springframework.lang.NonNullApi
org.springframework.lang.NonNullFields
org.springframework.lang.Nullable
org.springframework.lang.UsesJava7
org.springframework.lang.UsesJava8
org.springframework.lang.UsesSunHttpServer
org.springframework.lang.UsesSunMisc
org.springframework.objenesis.instantiator.annotations.Instantiator
org.springframework.scheduling.annotation.Async
org.springframework.scheduling.annotation.EnableAsync
org.springframework.scheduling.annotation.EnableScheduling
org.springframework.scheduling.annotation.Scheduled
org.springframework.scheduling.annotation.Schedules
org.springframework.stereotype.Component
org.springframework.stereotype.Controller
org.springframework.stereotype.Indexed
org.springframework.stereotype.Repository
org.springframework.stereotype.Service
org.springframework.validation.annotation.Validated

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值