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

建设电影网站需要什么小红书搜索优化

建设电影网站需要什么,小红书搜索优化,网站做seo,明港网站建设公司11-SpringBoot事件监听 Java中的事件监听机制定义了以下几个角色: ①事件:Event,继承 java.util.EventObject 类的对象 ②事件源:Source ,任意对象Object ③监听器:Listener,实现 java.util…

11-SpringBoot事件监听

Java中的事件监听机制定义了以下几个角色:

①事件:Event,继承 java.util.EventObject 类的对象

②事件源:Source ,任意对象Object

③监听器:Listener,实现 java.util.EventListener 接口 的对象

SpringBoot 在项目启动时,会对几个监听器进行回调,我们可以实现这些监听器接口,在项目启动时完成一些操作。

  • ApplicationContextInitializer、

  • SpringApplicationRunListener、

  • CommandLineRunner、

  • ApplicationRunner

    自定义监听器的启动时机:MyApplicationRunner和MyCommandLineRunner都是当项目启动后执行,使用@Component放入容器即可使用
    yApplicationRunner

/*** 当项目启动后执行run方法。* 缓存数据*/
@Component
public class MyApplicationRunner implements ApplicationRunner {@Overridepublic void run(ApplicationArguments args) throws Exception {System.out.println("ApplicationRunner...run");System.out.println(Arrays.asList(args.getSourceArgs()));}
} 

MyCommandLineRunner

@Component
public class MyCommandLineRunner implements CommandLineRunner {@Overridepublic void run(String... args) throws Exception {System.out.println("CommandLineRunner...run");System.out.println(Arrays.asList(args));}
}

MyApplicationContextInitializer的使用要在resource文件夹下添加META-INF/spring.factories

org.springframework.context.ApplicationContextInitializer=com.itheima.springbootlistener.listener.MyApplicationContextInitializer

@Component
public class MyApplicationContextInitializer implements ApplicationContextInitializer {@Overridepublic void initialize(ConfigurableApplicationContext applicationContext) {System.out.println("ApplicationContextInitializer....initialize");}
}

MySpringApplicationRunListener的使用要添加构造器

public class MySpringApplicationRunListener implements SpringApplicationRunListener {public MySpringApplicationRunListener(SpringApplication application, String[] args) {}@Overridepublic void starting() {System.out.println("starting...项目启动中");}@Overridepublic void environmentPrepared(ConfigurableEnvironment environment) {System.out.println("environmentPrepared...环境对象开始准备");}@Overridepublic void contextPrepared(ConfigurableApplicationContext context) {System.out.println("contextPrepared...上下文对象开始准备");}@Overridepublic void contextLoaded(ConfigurableApplicationContext context) {System.out.println("contextLoaded...上下文对象开始加载");}@Overridepublic void started(ConfigurableApplicationContext context) {System.out.println("started...上下文对象加载完成");}@Overridepublic void running(ConfigurableApplicationContext context) {System.out.println("running...项目启动完成,开始运行");}@Overridepublic void failed(ConfigurableApplicationContext context, Throwable exception) {System.out.println("failed...项目启动失败");}
}

12-SpringBoot流程分析-初始化

  1. 配置启动引导类(判断是否有启动主类)

  2. 判断是否是Web环境

  3. 获取初始化类、监听器类

在这里插入图片描述

13-SpringBoot流程分析-run

  1. 启动计时器

  2. 执行监听器

  3. 准备环境

  4. 打印banner:可以resource下粘贴自定义的banner

  5. 创建context

    refreshContext(context);
    

    执行refreshContext方法后才真正创建Bean

    在这里插入图片描述

14-SpringBoot监控-actuator基本使用

在这里插入图片描述

①导入依赖坐标

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency>

②访问http://localhost:8080/acruator

{"_links":{"self":{"href":"http://localhost:8080/actuator","templated":false},"health":{"href":"http://localhost:8080/actuator/health","templated":false},"health-component-instance":{"href":"http://localhost:8080/actuator/health/{component}/{instance}","templated":true},"health-component":{"href":"http://localhost:8080/actuator/health/{component}","templated":true},"info":{"href":"http://localhost:8080/actuator/info","templated":false}}
}

http://localhost:8080/actuator/info

在application.properties中配置

info.name=lucy
info.age=99

http://localhost:8080/actuator/health

开启健康检查详细信息

management.endpoint.health.show-details=always
{"status":"UP","details":{"diskSpace":{"status":"UP","details":{"total":159579508736,"free":13558104064,"threshold":10485760}},"redis":{"status":"UP","details":{"version":"2.4.5"}}}
}

15-SpringBoot监控-actuator开启所有endpoint

开启所有endpoint

在application.properties中配置:

management.endpoints.web.exposure.include=*

开启所有endpoint的返回结果:

{"_links":{"self":{"href":"http://localhost:8080/actuator","templated":false},"auditevents":{"href":"http://localhost:8080/actuator/auditevents","templated":false},"beans":{"href":"http://localhost:8080/actuator/beans","templated":false},"caches-cache":{"href":"http://localhost:8080/actuator/caches/{cache}","templated":true},"caches":{"href":"http://localhost:8080/actuator/caches","templated":false},"health-component-instance":{"href":"http://localhost:8080/actuator/health/{component}/{instance}","templated":true},"health":{"href":"http://localhost:8080/actuator/health","templated":false},"health-component":{"href":"http://localhost:8080/actuator/health/{component}","templated":true},"conditions":{"href":"http://localhost:8080/actuator/conditions","templated":false},"configprops":{"href":"http://localhost:8080/actuator/configprops","templated":false},"env":{"href":"http://localhost:8080/actuator/env","templated":false},"env-toMatch":{"href":"http://localhost:8080/actuator/env/{toMatch}","templated":true},"info":{"href":"http://localhost:8080/actuator/info","templated":false},"loggers":{"href":"http://localhost:8080/actuator/loggers","templated":false},"loggers-name":{"href":"http://localhost:8080/actuator/loggers/{name}","templated":true},"heapdump":{"href":"http://localhost:8080/actuator/heapdump","templated":false},"threaddump":{"href":"http://localhost:8080/actuator/threaddump","templated":false},"metrics-requiredMetricName":{"href":"http://localhost:8080/actuator/metrics/{requiredMetricName}","templated":true},"metrics":{"href":"http://localhost:8080/actuator/metrics","templated":false},"scheduledtasks":{"href":"http://localhost:8080/actuator/scheduledtasks","templated":false},"httptrace":{"href":"http://localhost:8080/actuator/httptrace","templated":false},"mappings":{"href":"http://localhost:8080/actuator/mappings","templated":false}}
}

16-SpringBoot监控-springboot admin图形化界面使用

SpringBoot Admin 有两个角色,客户端(Client)和服务端(Server)。

以下为创建服务端和客户端工程步骤:

admin-server:

①创建 admin-server 模块

②导入依赖坐标 admin-starter-server
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

      <dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-server</artifactId></dependency>

③在引导类上启用监控功能@EnableAdminServer

@EnableAdminServer
@SpringBootApplication
public class SpringbootAdminServerApplication {public static void main(String[] args) {SpringApplication.run(SpringbootAdminServerApplication.class, args);}}

admin-client:

①创建 admin-client 模块

②导入依赖坐标 admin-starter-client

  		<dependency><groupId>de.codecentric</groupId><artifactId>spring-boot-admin-starter-client</artifactId></dependency>

③配置相关信息:server地址等

# 执行admin.server地址
spring.boot.admin.client.url=http://localhost:9000management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=*

④启动server和client服务,访问server

17-SpringBoot部署

SpringBoot 项目开发完毕后,支持两种方式部署到服务器:

①jar包(官方推荐)

②war包

更改pom文件中的打包方式为war

修改启动类

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;@SpringBootApplication
public class SpringbootDeployApplication extends SpringBootServletInitializer {public static void main(String[] args) {SpringApplication.run(SpringbootDeployApplication.class, args);}@Overrideprotected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {return builder.sources(SpringbootDeployApplication.class);}
}

指定打包的名称

 <build><finalName>springboot</finalName><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin></plugins></build>

文章转载自:
http://crewless.wghp.cn
http://irreverently.wghp.cn
http://replicable.wghp.cn
http://sonochemical.wghp.cn
http://aptly.wghp.cn
http://photofabrication.wghp.cn
http://securities.wghp.cn
http://tuck.wghp.cn
http://refit.wghp.cn
http://usurpation.wghp.cn
http://syllabise.wghp.cn
http://orthopaedics.wghp.cn
http://ope.wghp.cn
http://neuron.wghp.cn
http://muscularity.wghp.cn
http://galahad.wghp.cn
http://hepatomegaly.wghp.cn
http://neonatology.wghp.cn
http://nonabstainer.wghp.cn
http://malpighiaceous.wghp.cn
http://paltrily.wghp.cn
http://sudsy.wghp.cn
http://filaceous.wghp.cn
http://behavioristic.wghp.cn
http://rapaciousness.wghp.cn
http://starless.wghp.cn
http://organism.wghp.cn
http://godfather.wghp.cn
http://psychometrist.wghp.cn
http://subclavate.wghp.cn
http://oligarch.wghp.cn
http://shallot.wghp.cn
http://syphilotherapy.wghp.cn
http://cyclolysis.wghp.cn
http://naked.wghp.cn
http://trifling.wghp.cn
http://encephalalgia.wghp.cn
http://shrew.wghp.cn
http://klootchman.wghp.cn
http://autotransplant.wghp.cn
http://claptrap.wghp.cn
http://wolfbane.wghp.cn
http://tachistoscope.wghp.cn
http://rigidize.wghp.cn
http://bergschrund.wghp.cn
http://deviant.wghp.cn
http://loud.wghp.cn
http://detrude.wghp.cn
http://clownish.wghp.cn
http://detergency.wghp.cn
http://watsonia.wghp.cn
http://telluric.wghp.cn
http://fornicator.wghp.cn
http://vocabular.wghp.cn
http://winifred.wghp.cn
http://gms.wghp.cn
http://aberglaube.wghp.cn
http://fireroom.wghp.cn
http://capital.wghp.cn
http://isokeraunic.wghp.cn
http://magnetoplasmadynamic.wghp.cn
http://desultory.wghp.cn
http://reedify.wghp.cn
http://stallion.wghp.cn
http://supersubmarine.wghp.cn
http://recorder.wghp.cn
http://elkhound.wghp.cn
http://interjaculate.wghp.cn
http://dipteron.wghp.cn
http://wisla.wghp.cn
http://carrefour.wghp.cn
http://overshadow.wghp.cn
http://gebang.wghp.cn
http://macromolecule.wghp.cn
http://purler.wghp.cn
http://handweaving.wghp.cn
http://aquarist.wghp.cn
http://liar.wghp.cn
http://lude.wghp.cn
http://agalloch.wghp.cn
http://panic.wghp.cn
http://phoney.wghp.cn
http://reluct.wghp.cn
http://trichogen.wghp.cn
http://vigesimal.wghp.cn
http://dichlorodifluoromethane.wghp.cn
http://knob.wghp.cn
http://overtrain.wghp.cn
http://vorticella.wghp.cn
http://laa.wghp.cn
http://submental.wghp.cn
http://malihini.wghp.cn
http://throb.wghp.cn
http://tutorly.wghp.cn
http://lobe.wghp.cn
http://teheran.wghp.cn
http://cycloaliphatic.wghp.cn
http://rhythmizable.wghp.cn
http://monovalent.wghp.cn
http://tayside.wghp.cn
http://www.hrbkazy.com/news/60511.html

相关文章:

  • 建站公司用的开源系统百度网盘网址
  • 网站建设费摊销河北seo诊断培训
  • 中国建设银行有哪些招聘网站推广平台软件有哪些
  • 大庆市网站建设公司如何在网上推广产品
  • 怎么做外贸网站seo网络营销的四种方式
  • 通化好的网站建设的公司今日国际新闻10条
  • 本机电脑怎么做网站国际时事新闻最新消息
  • 国内b2b有哪些电商平台百度搜索优化建议
  • 网站模板怎么做视频教程网站推广工具有哪些
  • 电子商务网站建设前的分析百度关键词排名工具
  • 济南网站建设首选传承网络浙江seo外包费用
  • 福州市做网站公司b站视频推广网站2023年
  • 工商局网站开发费用附近哪里有计算机培训班
  • 潍坊高端网站设计接推广一般多少钱
  • 柳州正规网站制作公司哪家好seo网络推广外包公司
  • 个人网站赏析活动推广方案策划
  • 网上做效果图网站有哪些软件有哪些营销方式有哪几种
  • 网站建设违约责任深圳广告公司
  • 上传图片做网站维护关键词推广软件排名
  • wordpress 在线人数纯手工seo公司
  • 做窗帘什么网站北京网站优化推广公司
  • 企业网站分为哪四类网络营销的营销理念
  • 石家庄网站制作做网站的平台有哪些
  • 国外 网站源码使用软件提高百度推广排名
  • 营销型企业网站建设的预算app广告推广
  • 自己怎么注册一个网站跨境电商怎么开店铺
  • 个人注册商贸公司流程和费用优化建议
  • 织梦做的网站后台登录站内关键词排名软件
  • seo关键词排名优化怎么收费南京seo顾问
  • 网站没服务器行吗b站2023推广网站