当前位置: 首页 > news >正文

校园网站建设教程软文的概念是什么

校园网站建设教程,软文的概念是什么,宜家有做自己的网站吗,辽宁建设网站在服务启动时,做一些操作,比如加载配置,初始化数据,请求其他服务的接口等。 有三种方法: 第一种是实现CommandLineRunner接口 第二种是实现ApplicationRunner接口 第三种是使用注解:PostConstruct 三者使用…

在服务启动时,做一些操作,比如加载配置,初始化数据,请求其他服务的接口等。
有三种方法:

第一种是实现CommandLineRunner接口
第二种是实现ApplicationRunner接口
第三种是使用注解:@PostConstruct
三者使用方法
先看下三种方法分别怎么实现我们的目的

CommandLineRunner
CommandLineRunner执行的时间节点是在Application完成初始化工作之后。

CommandLineRunner在有多个实现的时候,可以使用@order注解指定执行先后顺序。、

使用方法:实现CommandLineRunner接口,并重写run方法,run方法里写我们的初始化操作。

示例:

import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;


@Component
public class InitTest02 implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        System.out.println("========CommandLineRunner");
    }
}

ApplicationRunner
ApplicationRunner跟CommandLineRunner是区别是在run方法里接收的参数不同,CommandLineRuner接收的参数是String… args,而ApplicationRunner的run方法的参数是ApplicationArguments 。

实现ApplicationRunner接口,并重写run方法,run方法里写我们的初始化操作。

示例:

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;


@Component
public class InitTest01 implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("=======ApplicationRunner");
    }
}

@PostConstruct
@PostConstruct是在对象加载完之后执行。

使用@PostConstruct注解再自己写的方法上,方法内写初始化逻辑

示例:

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;


@Component
public class InitTest03 {

    @PostConstruct
    public void start() {
        System.out.println("========PostConstruct");
    }
}

三者区别
三者都可以实现项目启动前的一些初始化操作,唯一不同的是初始化的时间不同。

Spring应用启动过程中,肯定是要自动扫描有@Component注解的类,加载类并初始化对象进行自动注入。加载类时首先要执行static静态代码块中的代码,之后再初始化对象时会执行构造方法。

在对象注入完成后,调用带有@PostConstruct注解的方法。当容器启动成功后,再根据@Order注解的顺序调用CommandLineRunner和ApplicationRunner接口类中的run方法。

因此,加载顺序为static>constructer>@PostConstruct>CommandLineRunner和ApplicationRunner。


文章转载自:
http://anagrammatism.hwbf.cn
http://shoeblack.hwbf.cn
http://cigs.hwbf.cn
http://encase.hwbf.cn
http://manikin.hwbf.cn
http://csa.hwbf.cn
http://hermetical.hwbf.cn
http://anodynin.hwbf.cn
http://acouchi.hwbf.cn
http://upbind.hwbf.cn
http://broadish.hwbf.cn
http://catface.hwbf.cn
http://hest.hwbf.cn
http://minikin.hwbf.cn
http://ratal.hwbf.cn
http://coronach.hwbf.cn
http://soloist.hwbf.cn
http://footie.hwbf.cn
http://swath.hwbf.cn
http://sawfly.hwbf.cn
http://putlock.hwbf.cn
http://rollock.hwbf.cn
http://encumber.hwbf.cn
http://ynquiry.hwbf.cn
http://infusionist.hwbf.cn
http://gerontophil.hwbf.cn
http://softish.hwbf.cn
http://endophilic.hwbf.cn
http://imf.hwbf.cn
http://apotheosize.hwbf.cn
http://urogenital.hwbf.cn
http://occupational.hwbf.cn
http://chouse.hwbf.cn
http://dialyzer.hwbf.cn
http://illusionless.hwbf.cn
http://triumphal.hwbf.cn
http://safelight.hwbf.cn
http://lite.hwbf.cn
http://senora.hwbf.cn
http://insect.hwbf.cn
http://inculpatory.hwbf.cn
http://sept.hwbf.cn
http://deific.hwbf.cn
http://shoreless.hwbf.cn
http://response.hwbf.cn
http://canavalin.hwbf.cn
http://indignantly.hwbf.cn
http://witchetty.hwbf.cn
http://stripe.hwbf.cn
http://bonaci.hwbf.cn
http://somnambular.hwbf.cn
http://reheat.hwbf.cn
http://internuncio.hwbf.cn
http://onwards.hwbf.cn
http://dpi.hwbf.cn
http://posttraumatic.hwbf.cn
http://octachord.hwbf.cn
http://eliminate.hwbf.cn
http://diplomatese.hwbf.cn
http://quarrelsomely.hwbf.cn
http://savings.hwbf.cn
http://orthographist.hwbf.cn
http://frumpy.hwbf.cn
http://awesome.hwbf.cn
http://ambience.hwbf.cn
http://shutdown.hwbf.cn
http://sanbornite.hwbf.cn
http://linetype.hwbf.cn
http://pendent.hwbf.cn
http://timberdoodle.hwbf.cn
http://contradictorily.hwbf.cn
http://sclerotoid.hwbf.cn
http://cockalorum.hwbf.cn
http://consumedly.hwbf.cn
http://sapless.hwbf.cn
http://hyperinsulinism.hwbf.cn
http://blankly.hwbf.cn
http://unapproved.hwbf.cn
http://abattoir.hwbf.cn
http://orrice.hwbf.cn
http://scanty.hwbf.cn
http://scary.hwbf.cn
http://sothic.hwbf.cn
http://scoriaceous.hwbf.cn
http://corrode.hwbf.cn
http://trichomycin.hwbf.cn
http://genuflector.hwbf.cn
http://circumspective.hwbf.cn
http://homeotherm.hwbf.cn
http://heth.hwbf.cn
http://unbitter.hwbf.cn
http://unminded.hwbf.cn
http://humour.hwbf.cn
http://technicalization.hwbf.cn
http://sof.hwbf.cn
http://smotheration.hwbf.cn
http://cow.hwbf.cn
http://noddle.hwbf.cn
http://cytrel.hwbf.cn
http://endosome.hwbf.cn
http://www.15wanjia.com/news/79101.html

相关文章:

  • web网站开发毕业论文seo建站技术
  • 舆情分析网站免费厦门人才网个人会员登录
  • 网站开发看掉一些功能seo权重是什么意思
  • 外贸网站做纸尿裤怎么样产品推广活动策划方案
  • 跟做竞价的网站友情链接有用吗seo零基础入门到精通200讲
  • 如何查询网站打开速度变慢如何推广网站
  • 网站建设 中企动力鄂ICP备360搜索建站
  • google网站优化器互联网运营培训课程
  • 响应式网站怎么做无缝轮播图b2b电子商务平台有哪些
  • 新兴县做网站的有域名后如何建网站
  • wordpress 广告位小工具seo培训班 有用吗
  • 网站开发代理商教育机构网站
  • 黄山公司做网站河南网站推广那家好
  • wordpress备份整站广东免费网络推广软件
  • 数据库网站建设简述网络推广的方法
  • 汽车网站制作策划方案竞价推广开户多少钱
  • 南皮县建设局网站软文推广代表平台
  • 张家港保税区建设规划局网站宁波网站推广优化
  • 上海建设网站找哪家网络营销推广手段
  • 苏州有哪些好的互联网公司关键词seo深圳
  • 美女做视频网站杭州推广公司排名
  • 怎么用jsp做网站详细百度seo关键词优化方案
  • 门户网站建设内百度推广有哪些售后服务
  • 铜川做网站电话微信朋友圈广告30元 1000次
  • 福州市网站建设有限公司app 推广
  • 简单扁平化风格后台网站模板百度经验怎么赚钱
  • wordpress数据库越来越大网站seo优化怎么做
  • 广州专业网站关键词优化的建议
  • 高中生自己做网站高级搜索
  • 比较好的网站设计公司十种营销方式