|
|
<!DOCTYPE html> |
|
|
<html lang="zh"> |
|
|
<head> |
|
|
<!-- 元数据 --> |
|
|
<meta charset="utf-8"> |
|
|
<link rel="icon" href="/images/favicon.ico"> |
|
|
<title>框架注解 | YongKJ</title> |
|
|
<meta name="author" content="yongkj" /> |
|
|
<meta http-equiv="Cache-Control" content="no-transform" /> |
|
|
<meta http-equiv="Cache-Control" content="no-siteapp" /> |
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
|
|
<meta name="robots" content="index,follow" /> |
|
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" /> |
|
|
<meta name="format-detection" content="telphone=no, email=no" /> |
|
|
|
|
|
|
|
|
<meta name="description" itemprop="description" content="A pure heart and few desires." /> |
|
|
|
|
|
|
|
|
<meta name="description" content="SpringBoot之常用注解 在spring boot中,摒弃了spring以往项目中大量繁琐的配置,遵循约定大于配置的原则,通过自身默认配置,极大的降低了项目搭建的复杂度。同样在spring boot中,大量注解的使用,使得代码看起来更加简洁,提高开发的效率。这些注解不光包括spring boot自有,也有一些是继承自spring的。 项目配置注解 1)@SpringBoo"> |
|
|
<meta property="og:type" content="article"> |
|
|
<meta property="og:title" content="框架注解"> |
|
|
<meta property="og:url" content="https://blog.yongkj.cn/2021/02/05/java-framework-annotations/index.html"> |
|
|
<meta property="og:site_name" content="YongKJ"> |
|
|
<meta property="og:description" content="SpringBoot之常用注解 在spring boot中,摒弃了spring以往项目中大量繁琐的配置,遵循约定大于配置的原则,通过自身默认配置,极大的降低了项目搭建的复杂度。同样在spring boot中,大量注解的使用,使得代码看起来更加简洁,提高开发的效率。这些注解不光包括spring boot自有,也有一些是继承自spring的。 项目配置注解 1)@SpringBoo"> |
|
|
<meta property="og:locale" content="zh_CN"> |
|
|
<meta property="og:image" content="https://blog.yongkj.cn/2021/02/05/java-framework-annotations/1_lukasz&milena-summertimepoland.jpg"> |
|
|
<meta property="article:published_time" content="2021-02-05T12:56:52.000Z"> |
|
|
<meta property="article:modified_time" content="2023-05-30T04:26:16.701Z"> |
|
|
<meta property="article:author" content="yongkj"> |
|
|
<meta property="article:tag" content="配置"> |
|
|
<meta property="article:tag" content="组件"> |
|
|
<meta property="article:tag" content="扫描"> |
|
|
<meta property="article:tag" content="容器"> |
|
|
<meta name="twitter:card" content="summary"> |
|
|
<meta name="twitter:image" content="https://blog.yongkj.cn/2021/02/05/java-framework-annotations/1_lukasz&milena-summertimepoland.jpg"> |
|
|
<meta name="twitter:site" content="@Candiinya"> |
|
|
<link rel="alternate" href="atom.xml" type="application/atom+xml"> |
|
|
<!-- 站点验证相关 --> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 样式表文件 --> |
|
|
<link rel="stylesheet" id="kratos-css" href="/css/kratosr.min.css" type="text/css" media="all"> |
|
|
<link rel="stylesheet" id="highlight-css" href="/css/highlight.min.css" type="text/css" media="all"> |
|
|
<link rel="stylesheet" id="fontawe-css" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" type="text/css" media="all"> |
|
|
<link rel="stylesheet" id="nprogress-css" href="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.css" type="text/css" media="all"> |
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css"> |
|
|
|
|
|
|
|
|
<link rel="stylesheet" id="darkmode-css" href="/css/kr-dark.min.css" type="text/css" media="all"> |
|
|
|
|
|
<!-- 不得不预先加载的一些JS文件 --> |
|
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> |
|
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/qrcode_js@1.0.0/qrcode.min.js"></script> |
|
|
|
|
|
|
|
|
<meta name="generator" content="Hexo 5.2.0"></head> |
|
|
|
|
|
|
|
|
<body class="custom-background"> |
|
|
<div id="kratos-wrapper"> |
|
|
<div id="kratos-page"> |
|
|
<div id="kratos-header"> |
|
|
<div class="nav-toggle"><a class="kratos-nav-toggle js-kratos-nav-toggle"><i></i></a></div> |
|
|
<header id="kratos-header-section"> |
|
|
<div class="container"> |
|
|
<div class="nav-header"> |
|
|
<div class="color-logo"><a href="/">YongKJ</a></div> |
|
|
<nav id="kratos-menu-wrap"> |
|
|
<ul id="kratos-primary-menu" class="sf-menu"> |
|
|
|
|
|
|
|
|
<li><a href="/"><i class="fa fa-home"></i>首页</a></li> |
|
|
|
|
|
|
|
|
|
|
|
<li><a href="/archives/"><i class="fa fa-file"></i>档案馆</a></li> |
|
|
|
|
|
|
|
|
|
|
|
<li> |
|
|
<a><i class="fa fa-link"></i>链接</a> |
|
|
<ul class="sub-menu"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<li><a target="_blank" rel="noopener" href="http://software.yongkj.cn/software/">软件俱乐部</a></li> |
|
|
|
|
|
|
|
|
|
|
|
<li><a target="_blank" rel="noopener" href="http://pocketyun.yongkj.cn/pocketyun/">袖珍网盘吧</a></li> |
|
|
|
|
|
|
|
|
|
|
|
<li><a target="_blank" rel="noopener" href="http://study.yongkj.cn/">英语随身学</a></li> |
|
|
|
|
|
|
|
|
</ul> |
|
|
</li> |
|
|
|
|
|
|
|
|
|
|
|
<li><a href="/atom.xml"><i class="fa fa-rss"></i>RSS 订阅</a></li> |
|
|
|
|
|
|
|
|
|
|
|
<li><a href="/about/"><i class="fa fa-paper-plane"></i>关于我</a></li> |
|
|
|
|
|
|
|
|
</ul> |
|
|
</nav> |
|
|
</div> |
|
|
</div> |
|
|
</header> |
|
|
</div> |
|
|
<div class="kratos-start kratos-hero-2"> |
|
|
<!-- <div class="kratos-overlay"></div> --> |
|
|
<div class="kratos-cover kratos-cover-2 text-center"> |
|
|
<div class="desc desc2 animate-box"> |
|
|
<a href="/"><h2>YongKJ</h2><br><span>勇往直前,永不言弃</span></a> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<div id="kratos-blog-post"> |
|
|
<div class="container"> |
|
|
<div class="row"> |
|
|
|
|
|
<div id="main"> |
|
|
<section class="col-md-8"> |
|
|
<article> |
|
|
<div class="kratos-hentry kratos-post-inner clearfix"> |
|
|
<header class="kratos-entry-header"> |
|
|
<h1 class="kratos-entry-title text-center">框架注解</h1> |
|
|
|
|
|
<div class="kratos-post-meta text-center"> |
|
|
<span> |
|
|
<i class="fa fa-calendar"></i> 2021-02-05 |
|
|
<i class="fa fa-folder"></i> 分类于 <a class="label-link" href="/categories/Java%E5%AD%A6%E4%B9%A0/">Java学习</a> |
|
|
<i class="fa fa-user"></i> 作者 yongkj |
|
|
<i class="fa fa-edit"></i> |
|
|
|
|
|
|
|
|
~3.97K |
|
|
|
|
|
字 |
|
|
|
|
|
</span> |
|
|
</div> |
|
|
</header> |
|
|
<div class="kratos-post-content"> |
|
|
|
|
|
<div class="kratos-post-inner-toc"> |
|
|
<ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#SpringBoot%E4%B9%8B%E5%B8%B8%E7%94%A8%E6%B3%A8%E8%A7%A3"><span class="toc-number">1.</span> <span class="toc-text">SpringBoot之常用注解</span></a></li></ol> |
|
|
</div> |
|
|
|
|
|
<hr /> |
|
|
<h3 id="SpringBoot之常用注解"><a href="#SpringBoot之常用注解" class="headerlink" title="SpringBoot之常用注解"></a>SpringBoot之常用注解</h3><blockquote> |
|
|
<p>在spring boot中,摒弃了spring以往项目中大量繁琐的配置,遵循约定大于配置的原则,通过自身默认配置,极大的降低了项目搭建的复杂度。同样在spring boot中,大量注解的使用,使得代码看起来更加简洁,提高开发的效率。这些注解不光包括spring boot自有,也有一些是继承自spring的。</p> |
|
|
</blockquote> |
|
|
<ol> |
|
|
<li>项目配置注解</li> |
|
|
</ol> |
|
|
<p> 1)@SpringBootApplication 注解</p> |
|
|
<blockquote> |
|
|
<p>@SpringBootApplication是一个复合注解,包含了@SpringBootConfiguration,@EnableAutoConfiguration,@ComponentScan这三个注解。</p> |
|
|
</blockquote> |
|
|
<ul> |
|
|
<li><p>@SpringBootConfiguration:标注当前类是配置类,这个注解继承自@Configuration。并会将当前类内声明的一个或多个以@Bean注解标记的方法的实例纳入到srping容器中,并且实例名就是方法名。</p> |
|
|
</li> |
|
|
<li><p>@EnableAutoConfiguration:是自动配置的注解,这个注解会根据我们添加的组件jar来完成一些默认配置,我们做微服时会添加spring-boot-starter-web这个组件jar的pom依赖,这样配置会默认配置springmvc 和tomcat。</p> |
|
|
</li> |
|
|
<li><p>@ComponentScan:扫描当前包及其子包下被@Component,@Controller,@Service,@Repository注解标记的类并纳入到spring容器中进行管理。等价于<a href="context:component-scan">context:component-scan</a>的xml配置文件中的配置项。</p> |
|
|
<blockquote> |
|
|
<p>大多数情况下,这3个注解会被同时使用,基于最佳实践,这三个注解就被做了包装,成为了@SpringBootApplication注解</p> |
|
|
</blockquote> |
|
|
</li> |
|
|
</ul> |
|
|
<p> 2)@ServletComponentScan 注解</p> |
|
|
<ul> |
|
|
<li>Servlet、Filter、Listener 可以直接通过 @WebServlet、@WebFilter、@WebListener 注解自动注册,这样通过注解servlet ,拦截器,监听器的功能而无需其他配置,所以这次相中使用到了filter的实现,用到了这个注解</li> |
|
|
</ul> |
|
|
<p> 3)@MapperScan注解</p> |
|
|
<ul> |
|
|
<li>spring-boot支持mybatis组件的一个注解,通过此注解指定mybatis接口类的路径,即可完成对mybatis接口的扫描</li> |
|
|
<li>它和@mapper注解是一样的作用,不同的地方是扫描入口不一样。@mapper需要加在每一个mapper接口类上面。所以大多数情况下,都是在规划好工程目录之后,通过@MapperScan注解配置路径完成mapper接口的注入。</li> |
|
|
<li>添加mybatis相应组建依赖之后。就可以使用该注解。</li> |
|
|
</ul> |
|
|
<p> 4)资源导入注解</p> |
|
|
<ul> |
|
|
<li><p>@ImportResource @Import @PropertySource 这三个注解都是用来导入自定义的一些配置文件。</p> |
|
|
</li> |
|
|
<li><p>@ImportResource(locations={}) 导入其他xml配置文件,需要标准在主配置类上。</p> |
|
|
</li> |
|
|
<li><p>导入property的配置文件 @PropertySource指定文件路径,这个相当于使用spring的<importresource/>标签来完成配置项的引入。</p> |
|
|
</li> |
|
|
<li><p>@import注解是一个可以将普通类导入到spring容器中做管理</p> |
|
|
</li> |
|
|
</ul> |
|
|
<ol start="2"> |
|
|
<li>controller 层</li> |
|
|
</ol> |
|
|
<p> 1)@Controller注解</p> |
|
|
<ul> |
|
|
<li><p>@Controller 表明这个类是一个控制器类,和@RequestMapping来配合使用拦截请求,如果不在method中注明请求的方式,默认是拦截get和post请求。这样请求会完成后转向一个视图解析器。但是在大多微服务搭建的时候,前后端会做分离。所以请求后端只关注数据处理,后端返回json数据的话,需要配合@ResponseBody注解来完成。</p> |
|
|
</li> |
|
|
<li><p>这样一个只需要返回数据的接口就需要3个注解来完成,大多情况我们都是需要返回数据。也是基于最佳实践,所以将这三个注解进一步整合。</p> |
|
|
</li> |
|
|
<li><p>@RestController 是@Controller 和@ResponseBody的结合,一个类被加上@RestController 注解,数据接口中就不再需要添加@ResponseBody。更加简洁。</p> |
|
|
</li> |
|
|
<li><p>同样的情况,@RequestMapping(value=””,method= RequestMethod.GET ),我们都需要明确请求方式。这样的写法又会显得比较繁琐,于是乎就有了如下的几个注解。</p> |
|
|
</li> |
|
|
</ul> |
|
|
<table> |
|
|
<thead> |
|
|
<tr> |
|
|
<th>普通风格</th> |
|
|
<th>Rest风格</th> |
|
|
</tr> |
|
|
</thead> |
|
|
<tbody><tr> |
|
|
<td>@RequestMapping(value=“”,method = RequestMethod.GET)</td> |
|
|
<td>@GetMapping(value =“”)</td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td>@RequestMapping(value=“”,method = RequestMethod.POST)</td> |
|
|
<td>@PostMapping(value =“”)</td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td>@RequestMapping(value=“”,method = RequestMethod.PUT)</td> |
|
|
<td>@PutMapping(value =“”)</td> |
|
|
</tr> |
|
|
<tr> |
|
|
<td>@RequestMapping(value=“”,method = RequestMethod.DELETE)</td> |
|
|
<td>@DeleteMapping(value =“”)</td> |
|
|
</tr> |
|
|
</tbody></table> |
|
|
<blockquote> |
|
|
<p>这几个注解是 @RequestMapping(value=””,method= RequestMethod.xxx )的最佳实践。为了代码的更加简洁。</p> |
|
|
</blockquote> |
|
|
<p> 2)@CrossOrigin 注解</p> |
|
|
<ul> |
|
|
<li><p>@CrossOrigin(origins = “”, maxAge = 1000) 这个注解主要是为了解决跨域访问的问题。这个注解可以为整个controller配置启用跨域,也可以在方法级别启用。</p> |
|
|
</li> |
|
|
<li><p>我们在项目中使用这个注解是为了解决微服在做定时任务调度编排的时候,会访问不同的spider节点而出现跨域问题。</p> |
|
|
</li> |
|
|
</ul> |
|
|
<p> 3)@Autowired 注解</p> |
|
|
<ul> |
|
|
<li>这是个最熟悉的注解,是spring的自动装配,这个个注解可以用到构造器,变量域,方法,注解类型上。当我们需要从bean 工厂中获取一个bean时,Spring会自动为我们装配该bean中标记为@Autowired的元素。</li> |
|
|
</ul> |
|
|
<p> 4)@EnableCaching 注解</p> |
|
|
<ul> |
|
|
<li>个注解是spring framework中的注解驱动的缓存管理功能。自spring版本3.1起加入了该注解。其作用相当于spring配置文件中的cache manager标签。</li> |
|
|
</ul> |
|
|
<p> 5)@PathVariable 注解</p> |
|
|
<ul> |
|
|
<li>路径变量注解,@RequestMapping中用{}来定义url部分的变量名</li> |
|
|
</ul> |
|
|
<ol start="3"> |
|
|
<li>servcie层注解</li> |
|
|
</ol> |
|
|
<p> 1)@Service</p> |
|
|
<ul> |
|
|
<li>这个注解用来标记业务层的组件,我们会将业务逻辑处理的类都会加上这个注解交给spring容器。事务的切面也会配置在这一层。当让 这个注解不是一定要用。有个泛指组件的注解,当我们不能确定具体作用的时候 可以用泛指组件的注解托付给spring容器。</li> |
|
|
</ul> |
|
|
<p> 2)@Resource</p> |
|
|
<ul> |
|
|
<li><p>@Resource和@Autowired一样都可以用来装配bean,都可以标注字段上,或者方法上。 @resource注解不是spring提供的,是属于J2EE规范的注解。</p> |
|
|
</li> |
|
|
<li><p>两个之前的区别就是匹配方式上有点不同,@Resource默认按照名称方式进行bean匹配,@Autowired默认按照类型方式进行bean匹配。</p> |
|
|
</li> |
|
|
</ul> |
|
|
<ol start="4"> |
|
|
<li>持久层注解</li> |
|
|
</ol> |
|
|
<p> 1)@Repository</p> |
|
|
<ul> |
|
|
<li><p>@Repository注解类作为DAO对象,管理操作数据库的对象。</p> |
|
|
</li> |
|
|
<li><p>总得来看,@Component, @Service, @Controller, @Repository是spring注解,注解后可以被spring框架所扫描并注入到spring容器来进行管理</p> |
|
|
</li> |
|
|
<li><p>@Component是通用注解,其他三个注解是这个注解的拓展,并且具有了特定的功能。</p> |
|
|
</li> |
|
|
<li><p>通过这些注解的分层管理,就能将请求处理,义务逻辑处理,数据库操作处理分离出来,为代码解耦,也方便了以后项目的维护和开发。</p> |
|
|
</li> |
|
|
<li><p>所以我们在正常开发中,如果能用@Service, @Controller, @Repository其中一个标注这个类的定位的时候,就不要用@Component来标注。</p> |
|
|
</li> |
|
|
</ul> |
|
|
<p> 2)@Transactional</p> |
|
|
<ul> |
|
|
<li><p>通过这个注解可以声明事务,可以添加在类上或者方法上。</p> |
|
|
</li> |
|
|
<li><p>在spring boot中 不用再单独配置事务管理,一般情况是我们会在servcie层添加了事务注解,即可开启事务。要注意的是,事务的开启只能在public 方法上。并且主要事务切面的回滚条件。正常我们配置rollbackfor exception时 ,如果在方法里捕获了异常就会导致事务切面配置的失效。</p> |
|
|
</li> |
|
|
</ul> |
|
|
<ol start="5"> |
|
|
<li>其他相关注解</li> |
|
|
</ol> |
|
|
<ul> |
|
|
<li><p>@ControllerAdvice 和 @RestControllerAdvice:通常和@ExceptionHandler、@InitBinder、@ModelAttribute一起配合使用。</p> |
|
|
</li> |
|
|
<li><p>@ControllerAdvice 和 @ExceptionHandler 配合完成统一异常拦截处理。</p> |
|
|
</li> |
|
|
<li><p>@RestControllerAdvice 是 @ControllerAdvice 和 @ResponseBody的合集,可以将异常以json的格式返回数据。</p> |
|
|
</li> |
|
|
</ul> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="kratos-copyright text-center clearfix"> |
|
|
<h5>本作品采用 <a rel="license nofollow" target="_blank" href="http://creativecommons.org/licenses/by-sa/4.0/">知识共享署名-相同方式共享 4.0 国际许可协议</a> 进行许可</h5> |
|
|
</div> |
|
|
|
|
|
<footer class="kratos-entry-footer clearfix"> |
|
|
|
|
|
<div class="post-like-donate text-center clearfix" id="post-like-donate"> |
|
|
|
|
|
|
|
|
<a class="share" href="javascript:;"><i class="fa fa-share-alt"></i> 分享</a> |
|
|
<div class="share-wrap" style="display: none;"> |
|
|
<div class="share-group"> |
|
|
<a href="javascript:;" class="share-plain qq" onclick="share('qq');" rel="nofollow"> |
|
|
<div class="icon-wrap"> |
|
|
<i class="fa fa-qq"></i> |
|
|
</div> |
|
|
</a> |
|
|
<a href="javascript:;" class="share-plain qzone" onclick="share('qzone');" rel="nofollow"> |
|
|
<div class="icon-wrap"> |
|
|
<i class="fa fa-star"></i> |
|
|
</div> |
|
|
</a> |
|
|
<a href="javascript:;" class="share-plain weixin pop style-plain" rel="nofollow"> |
|
|
<div class="icon-wrap"> |
|
|
<i class="fa fa-weixin"></i> |
|
|
</div> |
|
|
<div class="share-int"> |
|
|
<div class="qrcode" id="wechat-qr"></div> |
|
|
<p>打开微信“扫一扫”,打开网页后点击屏幕右上角分享按钮</p> |
|
|
</div> |
|
|
</a> |
|
|
<a href="javascript:;" class="share-plain weibo" onclick="share('weibo');" rel="nofollow"> |
|
|
<div class="icon-wrap"> |
|
|
<i class="fa fa-weibo"></i> |
|
|
</div> |
|
|
</a> |
|
|
<a href="javascript:;" class="share-plain facebook style-plain" onclick="share('facebook');" rel="nofollow"> |
|
|
<div class="icon-wrap"> |
|
|
<i class="fa fa-facebook"></i> |
|
|
</div> |
|
|
</a> |
|
|
<a href="javascript:;" class="share-plain twitter style-plain" onclick="share('twitter');" rel="nofollow"> |
|
|
<div class="icon-wrap"> |
|
|
<i class="fa fa-twitter"></i> |
|
|
</div> |
|
|
</a> |
|
|
</div> |
|
|
<script type="text/javascript"> |
|
|
$(()=>{ |
|
|
new QRCode("wechat-qr", { |
|
|
text: "https://blog.yongkj.cn/2021/02/05/java-framework-annotations/", |
|
|
width: 150, |
|
|
height: 150, |
|
|
correctLevel : QRCode.CorrectLevel.H |
|
|
}); |
|
|
}); |
|
|
function share(dest) { |
|
|
const qqBase = "https://connect.qq.com/widget/shareqq/index.html?"; |
|
|
const weiboBase = "https://service.weibo.com/share/share.php?"; |
|
|
const qzoneBase = "https://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?"; |
|
|
const facebookBase = "https://www.facebook.com/sharer/sharer.php?"; |
|
|
const twitterBase = "https://twitter.com/intent/tweet?"; |
|
|
const hostUrl = "https://blog.yongkj.cn/2021/02/05/java-framework-annotations/"; |
|
|
const title = "「框架注解」"; |
|
|
const excerpt = `SpringBoot之常用注解 |
|
|
在spring boot中,摒弃了spring以往项目中大量繁琐的配置,遵循约定大于配置的原则,通过自身默认配置,极大的降低了项目搭建的复杂度。同样在spring boot中,大量注解的使用,使得代码看...`; |
|
|
let _URL; |
|
|
switch (dest) { |
|
|
case "qq" : _URL = qqBase+"url="+hostUrl+"&title="+title+"&desc=&summary="+excerpt+"&site=cxpy"; break; |
|
|
case "weibo" : _URL = weiboBase+"url="+hostUrl+"&title="+title+excerpt; break; |
|
|
case "qzone" : _URL = qzoneBase+"url="+hostUrl+"&title="+title+"&desc=&summary="+excerpt+"&site=cxpy"; break; |
|
|
case "facebook" : _URL = facebookBase+"u="+hostUrl; break; |
|
|
case "twitter" : _URL = twitterBase+"text="+title+excerpt+"&url="+hostUrl; break; |
|
|
} |
|
|
window.open(_URL); |
|
|
}; |
|
|
</script> |
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="footer-tag clearfix"> |
|
|
<div class="pull-left"> |
|
|
<i class="fa fa-tags"></i> |
|
|
<a class="tag-none-link" href="/tags/%E5%AE%B9%E5%99%A8/" rel="tag">容器</a>, <a class="tag-none-link" href="/tags/%E6%89%AB%E6%8F%8F/" rel="tag">扫描</a>, <a class="tag-none-link" href="/tags/%E7%BB%84%E4%BB%B6/" rel="tag">组件</a>, <a class="tag-none-link" href="/tags/%E9%85%8D%E7%BD%AE/" rel="tag">配置</a> |
|
|
</div> |
|
|
<div class="pull-date"> |
|
|
<span>最后编辑:2023-05-30</span> |
|
|
</div> |
|
|
</div> |
|
|
</footer> |
|
|
</div> |
|
|
|
|
|
<nav class="navigation post-navigation clearfix" role="navigation"> |
|
|
|
|
|
<div class="nav-previous clearfix"> |
|
|
<a title=" 基础知识" href="/2021/02/04/java-basic-knowledge/">< 上一篇</a> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="nav-next clearfix"> |
|
|
<a title=" 反射" href="/2021/02/06/java-reflect/">下一篇 ></a> |
|
|
</div> |
|
|
|
|
|
</nav> |
|
|
|
|
|
|
|
|
</article> |
|
|
</section> |
|
|
</div> |
|
|
|
|
|
<section id="kratos-widget-area" class="col-md-4 hidden-xs hidden-sm"> |
|
|
|
|
|
<aside id="krw-about" class="widget widget-kratos-about clearfix"> |
|
|
|
|
|
<div class="photo-background"></div> |
|
|
<div class="photo-wrapper clearfix"> |
|
|
<div class="photo-wrapper-tip text-center"> |
|
|
<img class="about-photo" src="/images/avatar.webp" /> |
|
|
</div> |
|
|
</div> |
|
|
<div class="textwidget"> |
|
|
|
|
|
<ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#SpringBoot%E4%B9%8B%E5%B8%B8%E7%94%A8%E6%B3%A8%E8%A7%A3"><span class="toc-number">1.</span> <span class="toc-text">SpringBoot之常用注解</span></a></li></ol> |
|
|
|
|
|
</div> |
|
|
</aside> |
|
|
|
|
|
<!-- Moved to about.ejs --> |
|
|
|
|
|
|
|
|
<aside id="krw-categories" class="widget widget-categories clearfix"> |
|
|
<h4 class="widget-title"><i class="fa fa-folder"></i>分类目录</h4> |
|
|
<ul class="category-list"><li class="category-list-item"><a class="category-list-link" href="/categories/Java%E5%AD%A6%E4%B9%A0/">Java学习</a><span class="category-list-count">12</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E7%AC%AC%E4%B8%80%E6%AC%A1/">第一次</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E8%8B%B1%E8%AF%AD%E5%AD%A6%E4%B9%A0/">英语学习</a><span class="category-list-count">8</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E9%9D%A2%E8%AF%95%E7%A7%AF%E7%B4%AF/">面试积累</a><span class="category-list-count">1</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E9%9F%B3%E4%B9%90%E7%A9%BA%E9%97%B4/">音乐空间</a><span class="category-list-count">3</span></li><li class="category-list-item"><a class="category-list-link" href="/categories/%E9%A1%B9%E7%9B%AE%E7%BB%8F%E5%8E%86/">项目经历</a><span class="category-list-count">3</span></li></ul> |
|
|
</aside> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<aside id="krw-tags" class="widget widget-kratos-tags clearfix"> |
|
|
<h4 class="widget-title"><i class="fa fa-tags"></i>标签聚合</h4> |
|
|
<div class="tag-clouds"> |
|
|
<a href="/tags/MySQL/" style="font-size: 0.6em;">MySQL</a> <a href="/tags/apility/" style="font-size: 0.6em;">apility</a> <a href="/tags/bus/" style="font-size: 0.6em;">bus</a> <a href="/tags/city/" style="font-size: 0.6em;">city</a> <a href="/tags/comfort/" style="font-size: 0.6em;">comfort</a> <a href="/tags/communication/" style="font-size: 0.6em;">communication</a> <a href="/tags/contribute/" style="font-size: 0.6em;">contribute</a> <a href="/tags/convenient/" style="font-size: 0.6em;">convenient</a> <a href="/tags/develop/" style="font-size: 0.6em;">develop</a> <a href="/tags/education/" style="font-size: 0.6em;">education</a> <a href="/tags/enhance/" style="font-size: 0.6em;">enhance</a> <a href="/tags/facility/" style="font-size: 0.6em;">facility</a> <a href="/tags/flight/" style="font-size: 0.6em;">flight</a> <a href="/tags/foreign/" style="font-size: 0.6em;">foreign</a> <a href="/tags/free/" style="font-size: 0.6em;">free</a> <a href="/tags/hello/" style="font-size: 0.6em;">hello</a> <a href="/tags/improve/" style="font-size: 0.8em;">improve</a> <a href="/tags/information/" style="font-size: 0.6em;">information</a> |
|
|
</div> |
|
|
</aside> |
|
|
|
|
|
|
|
|
|
|
|
<aside id="krw-posts" class="widget widget-kratos-poststab"> |
|
|
<h4 class="widget-title"><i class="fa fa-file"></i>最新文章</h4> |
|
|
<div class="tab-content"> |
|
|
<ul class="list-group"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a class="list-group-item" href="/2023/06/04/mysql-interview-questions/"><i class="fa fa-book"></i> MySQL 面试题</a> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a class="list-group-item" href="/2021/02/09/java-io-stream/"><i class="fa fa-book"></i> 输入输出流</a> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a class="list-group-item" href="/2021/02/08/java-class-loading/"><i class="fa fa-book"></i> 类加载</a> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a class="list-group-item" href="/2021/02/07/java-annotation/"><i class="fa fa-book"></i> 注解</a> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<a class="list-group-item" href="/2021/02/06/java-reflect/"><i class="fa fa-book"></i> 反射</a> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</ul> |
|
|
</div> |
|
|
</aside> |
|
|
|
|
|
|
|
|
</section> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<footer> |
|
|
<div id="footer"> |
|
|
<div class="kr-tool text-center"> |
|
|
<div class="tool"> |
|
|
|
|
|
<div class="box search-box"> |
|
|
<a href="/search/"> |
|
|
<span class="fa fa-search"></span> |
|
|
</a> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="box theme-box" id="darkmode-switch"> |
|
|
<span class="fa fa-adjust"></span> |
|
|
</div> |
|
|
|
|
|
|
|
|
</div> |
|
|
<div class="box gotop-box"> |
|
|
<span class="fa fa-chevron-up"></span> |
|
|
</div> |
|
|
</div> |
|
|
<div class="container"> |
|
|
<div class="row"> |
|
|
<div class="col-md-6 col-md-offset-3 footer-list text-center"> |
|
|
<ul class="kratos-social-icons"> |
|
|
|
|
|
|
|
|
<li><a target="_blank" rel="nofollow" href="https://t.me/CandyUnion"><i class="fa fa-telegram"></i></a></li> |
|
|
<li><a target="_blank" rel="nofollow" href="https://twitter.com/Candiinya"><i class="fa fa-twitter"></i></a></li> |
|
|
|
|
|
|
|
|
|
|
|
<li><a target="_blank" rel="nofollow" href="https://github.com/yongkj"><i class="fa fa-github"></i></a></li> |
|
|
<li><a target="_blank" rel="nofollow" href="/atom.xml"><i class="fa fa-rss"></i></a></li> |
|
|
</ul> |
|
|
<ul class="kratos-copyright"> |
|
|
<div> |
|
|
<li>© 2023 yongkj 版权所有.</li> |
|
|
<li>本站已运行<span id="span_dt">Loading...</span></li> |
|
|
</div> |
|
|
<div> |
|
|
<li>Theme <a href="https://github.com/Candinya/Kratos-Rebirth" target="_blank">Kratos:Rebirth</a></li> |
|
|
<li>Made with <i class="fa fa-heart throb" style="color:#d43f57"></i> by <a href="https://candinya.com" target="_blank" rel="nofollow">Candinya</a>.</li> |
|
|
</div> |
|
|
<div> |
|
|
<li>Powered by <a href="https://hexo.io" target="_blank" rel="nofollow">Hexo</a></li> |
|
|
<li>Hosted on <a href="https://www.yongkj.cn" target="_blank">勇往直前</a></li> |
|
|
</div> |
|
|
<div> |
|
|
|
|
|
|
|
|
</div> |
|
|
</ul> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</footer> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
<script defer src="https://cdn.jsdelivr.net/npm/bootstrap@3.3.4/dist/js/bootstrap.min.js"></script> |
|
|
<script defer src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.js"></script> |
|
|
<script>const notMobile = (!(navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)));</script> |
|
|
|
|
|
<div> |
|
|
<canvas id="snow"></canvas> |
|
|
<script async type="text/javascript" src="/js/snow.min.js"></script> |
|
|
</div> |
|
|
|
|
|
<script async src="/js/candy.min.js"></script> |
|
|
|
|
|
|
|
|
<script defer src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script> |
|
|
|
|
|
<script defer src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script> |
|
|
<script defer src="/js/kratosr.min.js"></script> |
|
|
<script defer src="/js/pjax.min.js"></script> |
|
|
|
|
|
|
|
|
<script defer src="/js/kr-dark.min.js"></script> |
|
|
|
|
|
|
|
|
|
|
|
</body> |
|
|
</html> |