首页 > 编程语言 >常用注解:Java、Spring框架

常用注解:Java、Spring框架

时间:2022-09-30 12:34:39浏览次数:81  
标签:Java org spring 博客园 boot springframework Spring ben 注解

Java 8

Spring Framework/Boot/Web

--

 

Java中的注解【很神奇】。ben发布于博客园

虽然用过很多,但是,对其感知仍然模糊,应该是对它们的使用原理不清楚所致。

本文仅整理一些自己常用的 注解:名称、所在位置等信息。

 

1、JDK的

rt.jar 包

ben发布于博客园

元注解:java.lang.annotation

@Target
@Retention
@Document
@Inherited
@Repeatable
@Native

 

标准注解:java.lang

@Override
@Deprecated
@SuppressWarnings
@FunctionalInterface
@SafeVarargs

ben发布于博客园

javax下的注解:javax.annotation

@Resource
@Resources
@Generated
@PostConstruct
@PreDestroy

ben发布于博客园

2、Spring Framework的

Spring Framework 由哪些 jar包 组成呢?

  • spring-core
  • spring-context
  • spring-beans
  • spring-aop
  • spring-expression
  • 等等 TODO

 

spring-core: org.springframework.core.annotation

@AliasFor
@Order

 

spring-beans: org.springframework.beans.factory.annotation

@Autowired
@Qualifier
@Value

ben发布于博客园

spring-context: org.springframework.stereotype

@Indexed
@Component
@Controller
@Service
@Repository

ben发布于博客园

spring-context: org.springframework.context.annotation

@Import
@ImportResource
@Bean
@ComponentScan
@ComponentScan#@Filter
@ComponentScans
@Configuration
@Lazy
@Primary
@Profile
@PropertySource
@PropertySources
@Conditional

ben发布于博客园

spring-context: org.springframework.scheduling.annotation

@Async
@EnableAsync
@Scheduled
@EnableScheduling
@Schedules

 

3、Spring Web的

Web服务开发相关的注解整理。

ben发布于博客园

spring-web: org.springframework.web.bind.annotation

@RestController
@RestControllerAdvice
@ControllerAdvice
@CrossOrigin
@ExceptionHandler
@Mapping
@RequestMapping
@GetMapping
@PostMapping
@DeleteMapping
@PatchMapping
@PutMapping
@PathVariable
@RequestBody
@RequestHeader
@RequestParam
@RequestPart
@CookieValue
@SessionAttribute
@SessionAttributes

ben发布于博客园

4、Spring Boot的

Spring Boot相关包中用到的类。

Spring Boot下的 jar包 有哪些?

  • spring-boot
  • spring-boot-autoconfigure
  • spring-boot-starter
  • spring-boot-starter-json
  • spring-boot-starter-tomcat
  • 等等 TODO

 

spring-boot: org.springframework.boot

@SpringBootConfiguration

ben发布于博客园

spring-boot-autoconfigure: org.springframework.boot.autoconfigure

@SpringBootApplication
@EnableAutoConfiguration
@AutoConfigurationPackage
@AutoConfigureAfter
@AutoConfigureBefore
@AutoConfigureOrder
@ImportAutoConfiguration

 

spring-boot-autoconfigure: org.springframework.boot.autoconfigure.condition

@ConditionalOnBean
@ConditionalOnClass
@ConditionalOnCloudPlatform
@ConditionalOnExpression
@ConditionalOnJava
@ConditionalOnMissingBean
@ConditionalOnMissingClass
@ConditionalOnNotWebApplication
@ConditionalOnProperty
@ConditionalOnResource
@ConditionalOnWarDeployment
@ConditionalOnWebApplication

ben发布于博客园

参考资料

1、java注解的使用

https://www.cnblogs.com/chentang/p/13959831.html

2、java开发注解大全

https://www.cnblogs.com/ranandrun/p/annotation.html

3、

ben发布于博客园

标签:Java,org,spring,博客园,boot,springframework,Spring,ben,注解
From: https://www.cnblogs.com/luo630/p/16744452.html

相关文章

  • 【java基础】HashSet插入顺序问题
    总结:1、HashSet底层的插入是通过HashMap来实现的2、HashSet并不按照插入的顺序存储,它是无序的3、LinkedHashSet中的元素可以按照它们插入规则集的顺序提取@Test......
  • java 多线程
    线程的状态:New、Runnable、Blocked、Waiting、Timedwaiting、Terminated  newThread()——>New、start()——>Runnable、等待资源——>Blocked、wait()——>waiting......
  • PowerDesigner提示Could not Initialize JavaVM!
    PowerDesigner逆向mysql数据库报CouldnotInitializeJavaVM!提示,是因为powerdesigner基于32位JVM的原因。解决办法:安装32位的JDK或者安装mysql的ODBC驱动(重要提示:务......
  • Install4j for Mac(java安装程序创建器)
    Install4j版是一款很不错的java安装文件生成工具,提供强大的脚本编辑器、命令行编辑器、安装包设计IDE、JRE管理和部署等功能,主要用于生成java应用程序本地化的安装和应用程......
  • 4 MyBatis注解
    八、使用注解开发1.面向接口编程根本原因:解耦,可拓展,提高复用,分层开发中,上层不用管具体的实现,大家都遵守共同的标准,使得开发变得容易,规范性更好。关于接口的理解......
  • 用IO多路复用实现 nginx 静态资源代理(C/Java/Golang)
    用IO多路复用实现nginx静态资源代理(C/Java/Golang)效果展示代理HTML代理图片注意,静态资源代理基于HTTP,可以了解上一篇文章:几十行代码使用TCP简单实现HTT......
  • Java 模拟Terminal连接 Linux Console 源代码
    代码和效果如下,已经转换java文件为exe文件,注意要在Pom文件里面添加依赖。  packagecom.javassh3.javassh3;/*-*-mode:java;c-basic-offset:2;indent-tabs-mode:n......
  • java 获取当前时间并转化为yyyy-MM-dd HH:mm:ss格式 时间戳和字符串之间转换
    java获取当前时间并转化为yyyy-MM-ddHH:mm:ss格式时间戳和字符串之间转换方法一(线程不安全,不建议使用)privateSimpleDateFormatsdf=newSimpleDateFormat("yy......
  • Java获取当天或者明天等零点时间(00:00:00)0时0分0秒的方法 Calendar calendar = Calend
    Java获取当天或者明天等零点时间(00:00:00)0时0分0秒的方法Calendarcalendar=Calendar.getInstance();Java获取当天或者明天等零点时间(00:00:00)0时0分0秒的方法Sim......
  • java基础day-02
    第二章、面向对象一、什么是面向对象面向对象就是用人的世界观改变计算机世界观1.1对象万物皆可对象学习面向对象之前先了解什么是属性和行为?属性:表示的是事物的特征,是静态......