java学习总结

官方网站本身使用Spring框架开发,随着功能以及业务逻辑的日益复杂,应用伴随着大量的XML配置文件以及复杂的Bean依赖关系。WiththereleaseofSpring3.0,theSpringIOteamprimarykeybegantogetridoftheXMLconfigurationfile,andinthedevelopmentprocess,theideaof

https://spring.io/guides

http://www.spring4all.com/article/246

http://www.spring4all.com/article/558

http://www.ityouknow.com/spring-boot.html

Spring 官方网站本身使用Spring 框架开发,随着功能以及业务逻辑的日益复杂,应用伴随着大量的XML配置文件以及复杂的Bean依赖关系。

With the release of Spring 3.0, the Spring IO team primary key began to get rid of the XML configuration file, and in the development process, the idea of “convention over configuration” was widely used to get rid of all kinds of complex configurations in the Spring framework, and Java Config was derived.

Spring Boot就是在这样的背景下抽象出来的发展框架。它并不提供Spring Framework本身的核心特性和扩展功能,只是用来快速敏捷地开发基于Spring Framework的新一代应用。换句话说,它不是替代Spring的解决方案,而是与Spring框架紧密结合的工具,用来提升Spring开发者体验。同时集成了大量常用的第三方库配置(如杰克森、JDBC、Mongo、Redis、Mail等。).Spring Boot应用程序中的这些第三方库几乎可以开箱即用地进行配置,大多数Spring Boot应用程序只需要非常少量的配置代码,因此开发人员可以更专注于业务逻辑。

这个项目旨在帮助开发者更容易地创建基于Spring的应用和服务,以便现有的和新的Spring开发者能够最快速地获得所需的Spring功能。

Spring Boot不生成代码,根本不需要XML配置。其主要目标如下:

-为所有Spring开发工作提供更快、更广泛的引入体验。

-开箱即用,您还可以通过修改默认值来快速满足您的项目需求。

-提供大型项目中常见的一系列非功能特性,如嵌入式服务器、安全性、指示器、健康检查、外部配置等。

让我们创建一个HelloController.java并定义三种方法。

包org . spring boot . sample . controller;

导入Java . util . ArrayList;

导入Java . util . hashmap;

导入Java . util . list;

导入Java . util . map;

导入org . spring framework . web . bind . annotation . request mapping;

导入org . spring framework . web . bind . annotation . request param;

导入org . spring framework . web . bind . annotation . rest controller;

@RestController

@RequestMapping("/hello ")

公共类HelloController {

@RequestMapping

公共字符串hello() {

返回“你好弹簧靴”;

}

@RequestMapping("/info ")

公共映射< String,String > getInfo(@ request param String name){

Map<String,String > map = new HashMap < >();

map.put("name ",名称);

返回地图;

}

@RequestMapping("/list ")

public List<Map<String,String>> getList() {

List<Map<String,String > > list = new ArrayList < >();

Map<String,String > map = null

for(int I = 1;I < = 5;i++) {

map = new HashMap < >();

map.put("name "," Shanhy-"+I);

list.add(地图);

}

退货单;

}

}

那你现在就可以直接运行了。
SpringBootSampleApplication的主要方法和执行普通java程序是一样的。

然后我们可以看到spring-boot有一个内置的服务器容器(默认是Tomcat),spring-boot为我们完成了这一切。

控制台输出内容已开始
7.358秒内的springbootsampleapplication(JVM运行9.154)表示服务已经启动。

在浏览器中输入我们的3个请求,您将看到结果。

http://localhost:8080/您好

输出:你好,弹簧靴

http://localhost:8080/hello/info?name=shanhy

输出:{"name": "shanhy"}

http://localhost:8080/hello/list

输出:[{"name": "shanhy-1"},{"name": "shanhy-2"},{"name": "shanhy-3"},{"name": "shanhy-4"},{"name": "shanhy。

通过我们的Hello例子,相信大家一眼就能看出,spring-boot创建一个项目就是这么简单,几分钟就能启动服务。

Spring-boot抛弃了繁琐的配置,允许开发人员将更多精力放在业务逻辑的实现上。下面的文章将通过例子向您展示spring-boot的许多方面。

依赖库

https://github . com/阿里巴巴/德鲁伊/tree/master/德鲁伊-spring-boot-starter

https://github.com/prometheus/prometheus

https://github.com/netdata/netdata

https://github.com/OpenFeign/feign

https://www.yiibai.com/springjdbc/create_query.html

https://juejin.im/post/5aa38906f265da239147b95e

https://zhuanlan.zhihu.com/p/31385073

http://blog.wxcsdb88.com/2017/08/29/spring-boot-https/

https://zhuanlan.zhihu.com/p/32545108

https://www.jianshu.com/p/3b1ba2158f5b

是什么原因导致它从两个时钟变成了两天?

第一天早上看下面的教程:

https://www.cnblogs.com/ityouknow/p/6037431.html

https://github . com/ityouknow/spring-boot-examples/tree/master/spring-boot-mybatis-annotation

实现本教程,然后观看下面的教程

https://www.yiibai.com/mybatis/install_configure.html

漏一句话导致时间浪费:3个小时左右。

下午4: 30开始正式写代码,选择了以下模型移植到fusionmind:

https://www.jianshu.com/p/5cd772c07041

https://blog . csdn . net/Winter _ Chen 001/article/details/78622141

19点移植完成,但是很多问题开始定位。

22:55,数据可以分发到dls数据库中的数据库。

各种配置问题

第二天早上增加了删除接口,传入了参数整数的问题。上午11点解决问题,用了3个小时。

但是发现json发送给数据库的post为NULL,晚上8点用了8个小时才解决这个问题。

https://www.bysocket.com/?p=1627

在注释模式下添加mybatis,发现空指针的问题(
Java.lang.NullPointerException),总共需要4个小时。

Mybatis多表联合查询的方法;

https://my.oschina.net/u/2278977/blog/866608

https://www.cnblogs.com/shengulong/p/8385966.html

https://blog.csdn.net/wfq784967698/article/details/78786001

MySql:

启动与关闭:

窗子操作系统下

启动服务

mysqldadmin开始或net start mysql

关闭服务

mysqladmin -uroot关闭

net stop mysql

Linux操作系统操作系统下

启动服务

服务mysqld启动

关闭服务

服务mysqld停止

重启服务

服务mysqld重启

MySQL–u root-p

https://blog.csdn.net/ithomer/article/details/5131863

https://blog . csdn . net/HXChuangxiaochuan/article/details/79000881

https://blog.csdn.net/hopyGreat/article/details/80526993

PostgreSQL:

http://3ms.huawei.com/hi/group/2952325/thread_5756407.html?mapId=7131187

http://3ms.huawei.com/km/blogs/details/5661201

PostgreSQL常见命令

https://www.jianshu.com/p/8515a02492f1

https://www.yiibai.com/html/postgresql/2013/080436.html

/usr/local/postgresql10.6/data

pg_ctl重启

Python连接mysql或者postgres(sqlalchemy)。

https://my.oschina.net/u/2245781/blog/665075

Linux安装Redis

https://blog.csdn.net/u011669700/article/details/79566713

https://www.jianshu.com/p/bc84b2b71c1c

https://blog.csdn.net/xiazdong/article/details/7059573

JSONArray到列表

https://blog.csdn.net/qq_36306340/article/details/78732203

公共静态void main(String[] args) {

JSON array JSON array = new JSON array();

JSON array . add(" 1 ");

JSON array . add(" 2 ");

JSON array . add(" 3 ");

JSON array . add(" 4 ");

JSON array . add(" 5 ");

JSON array . add(" 6 ");

system . err . println(JSON array);

//将json数据放入列表。

list list = new ArrayList < >();

for(Object jstr:jsonArray){

list . add(jstr);

}

system . out . println(list);

}

Java解析Json数据的两种方法

https://blog . csdn . net/chenfengdjuanlian/article/details/52190462

Java-读取JSON文件

https://blog.csdn.net/ALemon_Y/article/details/71436194

用Java解析JSON文件的方法

https://blog . csdn . net/mingtianhaiyouwo/article/details/51336381

使用json-在java中- JSONObject和JSONArray相互嵌套。

https://blog . csdn . net/flyliuweisky 547/article/details/1917 21 33

Java封装多层json

https://blog.csdn.net/pan12jian/article/details/25987505

java中字符串与json的转换

https://blog.csdn.net/u011575570/article/details/47863337

java中的Json字符串删除指定的属性。

https://blog.csdn.net/DUDUfine/article/details/52218463

添加Java的路径

https://codeday.me/bug/20171122/98549.html

Java判断文件或文件夹是否存在。

https://blog.csdn.net/itmyhome1990/article/details/51243997

另一方面,反斜杠()与紧随其后的字符形成转义字符,例如“
”(表示换行符)和“”(表示字符“”),因此字符“”在字符串中应由“”表示。例如,如果像这样定义一个字符串,strings =。

Java |映射、列表和集合的区别

https://www.jianshu.com/p/f7365230dcf2

Java中List和ArrayList的区别

https://blog.csdn.net/erlian1992/article/details/51298276

https://www.jianshu.com/p/a6a708350743

https://blog.csdn.net/da_caoyuan/article/details/79819221

https://www.jianshu.com/p/3d1fb84b2b63

http://www.trinea.cn/android/hashmap-loop-performance/

https://blog.csdn.net/fofabu2/article/details/78964079

Ioc和java反射技术是什么关系?

Ioc和依赖注入有什么关系?

https://www.cnblogs.com/weiyinfu/p/6835301.html

https://blog.csdn.net/HEYUTAO007/article/details/5981555

https://blog.csdn.net/gdutxiaoxu/article/details/68947735

https://juejin.im/post/598ea9116fb9a03c335a99a4

https://www . sczyh 30 . com/posts/Java/Java-reflection-1/# % E4 % B8 % 80% E3 % 80% 81% E5 % 9B % 9E % E9 % A1 % BE % EF % BC % 9A % E4 % BB % 80% E4 % B9 % 88% E6 % 98% AF % E5 % 8F % 8D % E5 % B0 % 84% EF % BC % 9F

https://blog.csdn.net/pengone/article/details/49816131

https://blog.csdn.net/ylforever/article/details/79191182

Postgres下如何返回插入对象的ID?

http://mybatis-user . 963551 . n3 . nable . com/How-to-return-ID-of-the-inserted-object-under-Postgres-TD 1926959 . html

http://www.runoob.com/java/java8-streams.html

经常看列表<?> list= new ArrayList <?>

地图<?,?> map = new HashMap <?,?>

但是发现list只是ArrayList的接口,并不是它的父类,也不是指向子类对象的父类引用。

如果是,应该是abstract list ablist = new ArrayList();还是直接写ArrayList <?> list= new ArrayList <?>

为什么使用接口引用指向实现类的对象?

这种写法实际上是Java 语言(一种计算机语言,尤用于创建网站)多态性的表现形式

多态的定义:指的是允许不同类的对象响应同一个消息。也就是说,同一个消息根据发送对象的不同,可以采用很多不同的行为。(发送消息是一个函数调用)

列表列表;就是在堆栈区开辟一个空间放列表引用,并没有创建对象,所以不知道你list= new ArrayList()的时候是ArrayList还是LinkedList创建ArrayList对象。并将您开始创建的列表引用指向这个对象。ArrayList和LinkedList都是List的实现类。

为什么一般用List list = new ArrayList()而不用ArrayList alist = new ArrayList()?

问题是List有多个实现类,如LinkedList或Vector等。现在你使用数组列表。也许有一天你需要切换到其他实现类。这时候你只需要修改这一行:List List = new linked List();其他使用list的地方代码根本不需要修改。假设你开始使用ArrayList alist = new ArrayList(),并且你已经改变了它,特别是如果你使用了ArrayList特有的方法和属性。,如果没有特殊需求,最好使用List List = new linked List();这就是面向接口编程的优势。

需要注意的事项

List只能使用已经在ArrayList中实现的List接口中的方法,那些没有在List接口中定义的ArrayList中自己的方法是无法访问的。

List.add()实际上是List接口的一个方法。

但是调用ArrayList的方法,比如clone(),是不能调用的。

接口的灵活性在于“指定一个类必须做什么,不管你怎么做”。我们可以定义一个接口类型的引用变量来引用实现该接口的类的实例。当这个引用调用一个方法时,会根据实际引用的类的实例来判断调用哪个方法,类似于上面提到的超类引用访问子类对象的机制。

//定义接口InterA

界面

{

 虚空乐趣();

}

//实现接口InterA的类b

B类实现InterA

{

 公共void fun()

 {

  System.out.println("这是B ");

 }

}

//实现接口InterA的c类

C类实现InterA

{

 公共void fun()

 {

  System.out.println("这是C ");

 }

}

分类试验

{

 公共静态void main(String[] args)

 {

  InterA a;

  a = new B();

  a . fun();

  a = new C();

  a . fun();

 }

}

输出结果是:

这是B

这是C

  上例中,B类和C类是实现接口InterA的两个类,分别实现了接口的方法fun()。通过将B类和C类的实例赋给接口引用A,实现了方法在运行时的动态绑定,充分利用了“一个接口,多个方法”,展现了Java的动态多态性。

  需要注意的一点是,当Java通过使用接口变量调用其实现类的对象的方法时,该方法必须已经在接口中声明,并且接口的实现类中实现方法的类型和参数必须与接口中定义的类型和参数完全匹配。

https://blog.csdn.net/carson_ho/article/details/54910472

Java中线程池的顶层接口是Executor,但严格来说Executor并不是线程池,只是一个执行线程的工具。真正的线程池接口是ExecutorService。下图完整描述了线程池的类架构。

https://zyjustin9.iteye.com/blog/2092131

https://blog.csdn.net/lkforce/article/details/80253426

http://xiamianyu . github . io/2017/06/28/Java-% E5 % 90% AF % E5 % 8A % A8 % E5 % 8F % 82% E6 % 95% B0/

https://blog.csdn.net/gx304419380/article/details/80265720

https://www.cnblogs.com/xiaoqi/p/6955288.html

https://blog.csdn.net/u012613251/article/details/80331994

https://code.skyheng.com/post/34603.html

https://www.cnblogs.com/keeya/p/10101547.html

https://www.jianshu.com/p/46b530446d20

https://blog.51cto.com/11931236/2058708

https://blog.csdn.net/west_609/article/details/74906495

https://www.cnblogs.com/lmk-sym/p/6554382.html

https://www.cnblogs.com/littleatp/p/5922362.html

https://blog . csdn . net/liuchunming 033/article/details/48470575

https://www.cnblogs.com/yang-wu/p/3262499.html

https://ning Yu 1 . github . io/site/post/93-maven-depen pency-analyze/

https://blog.csdn.net/qq_27093465/article/details/69226949

https://zhuanlan.zhihu.com/p/40785962

https://yq.aliyun.com/articles/2368

https://juejin.im/post/5b31b9eff265da598826c200

https://segmentfault.com/a/1190000013077817

https://juejin.im/post/5b5efff0e51d45198469acea

https://blog.csdn.net/qq_32423845/article/details/81199854

https://blog.csdn.net/qq_27603235/article/details/51604584

http://www.voidcn.com/article/p-kbigwhhu-bey.html

赠送20本心理学电子书,添加 微信:56163509  备注:心理学

本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 sumchina520@foxmail.com 举报,一经查实,本站将立刻删除。
如若转载,请注明出处:https://www.xinli1988.com/46753.html