Unknown run configuration type SpringBootApplicationConfigurationType
https://blog.csdn.net/weixin_44146305/article/details/90178020
社区版的idea自己安装插件,去配置
Servlet Servlet生命周期
Servlet是一种规范,即为接口。
Servlet是Javaweb三大组件之一(Servlet程序、Filter过滤器、Listener监听器)
是小型java程序,通常通过HTTP(超文本传输协议)接收和响应来自Web客户端的请求。3、相对路径和绝对路径
相对路径:
. 表示当前目录
… 表示上一级的目录
资源名 表示当前的目录/资源名
绝对路径
http://ip:port/工程路径/资源路径
4、请求重定向的方案
1、
设置响应状态码302,表示重定向
resp.serStatus(302)
设置响应头,说明新的地址在那里
resp.serHeader(“Location”,“http://localhost:8080”);
2、方案
resp.sensRedirect(“http://localhost:8080”);
2.update与alter区别
update 是修改记录 alter 是修改表结构,添加字段
3、url---->Servlet访问
4、Servlet生命周期
(1 执行Servlet构造方法)
2 执行init()
3 service()
4 destroy()
java用swith取代多个if else
swith取代多个if else
@ApiModelProperty("类型 1:省份宏观 2竞争分析 3区域分析 4位置推荐 5:城市宏观") private int type;
log.info("processReportInstanceByOperatorLog reportOperatorLog = {}", reportOperatorLog); switch (reportOperatorLog.getType()) { case ReportConstant.REPORT_TYPE_PROVINCE: doProvinceReportInstance(reportOperatorLog); break; case ReportConstant.REPORT_TYPE_COMPETE: doCompeteReportInstance(reportOperatorLog, user); break; case ReportConstant.REPORT_TYPE_REGION_ANALYSIS: doRegionAnalysisReportInstance(reportOperatorLog); break; case ReportConstant.REPORT_TYPE_SELECTION: doSelectionReportInstance(reportOperatorLog); break; case ReportConstant.REPORT_TYPE_CITY: doCityReportInstance(reportOperatorLog); break; default: log.warn("do not have this work reportOperatorLog = {}", reportOperatorLog); break; }
重载与重写
package polymorphic; public class Test { public static void main(String[] args) { show(new Cat()); show(new Dog()); System.out.println("-------------"); Animal a = new Cat(); a.eat(); a.eat(3); //a.work(); Cat b = (Cat)a; b.sport(); Animal a2 = new Dog(); a2.eat(); //a.work(); Dog b2 = (Dog)a2; b2.sport(); Work d = new Work(); d.work(); Work f = new Cat2(); f.work(); } public static void show(Animal a) { a.eat(); if(a instanceof Cat) { Cat c = (Cat)a; c.sport(); }else if (a instanceof Dog) { Dog c = (Dog)a; c.sport(); } } } class Work{ public void work() { System.out.println("Catch mice"); } } abstract class Animal{ public abstract void eat() ; public void eat(int num) { System.out.println("[重载1eat rice]"); for(int i = 0; i < num; i++) System.out.println("[重载1eat rice]"); } } class Cat2 extends Work{ public void way() { System.out.println("重写"); } public void work() { System.out.println("[重写 again]"); } } class Cat extends Animal{ //int num = 2; //System.out.println("Hi, I am a Cat."); public void eat() { System.out.println("1eat fish"); } public void sport() { System.out.println("1can flow"); } } class Dog extends Animal{ //System.out.println("Hi, I am a Dog."); public void eat() { System.out.println("2eat beef"); } public void sport() { System.out.println("2can run"); } }