Elasticsearch介绍及安装

Elasticsearch是一个建立在全文搜索引擎Apache Lucence基础上的搜索引擎,可以说Lucence是当今世界最先进、最高效的全功能开源搜索引擎框架。但是Lucence只是一个框架,要充分利用它的功能,需要使用Java,并且在应用程序中集成Lucence。更糟糕的是,还需要做很多的学习、了解,才能明白它是如何运行的,Lucence确实非常复杂。

Linux查看端口占用情况

查看80端口的占用情况:lsof -i:80 或者 netstat -apn | grep 80

VMware中Ubuntu静态IP设置方法

首先确认下VMware中相关网络的设置情况:

Ubuntu更换阿里源方法

Ubuntu更换阿里源方法小结:

Ubuntu下安装ssh服务

判断是否已经安装ssh服务:

反向代理服务器的工作原理

(一)概述

反向代理(Reverse Proxy)方式是指以代理服务器来接受Internet上的连接请求,然后将请求转发给内部网络上的服务器;并将从服务器上得到的结果返回给Internet上请求连接的客户端,此时代理服务器对外就表现为一个服务器。

MyBatis使用properties配置及类别名使用

(一)将连接数据库的配置单独放在一个properties文件中

可以直接将数据库的连接配置信息写在MyBatis的conf.xml文件中,如下:

MyBatis实现关联表查询

(一)一对一关联

1.1 提出需求

根据班级id查询班级信息(带老师信息)

Spring MVC @ModelAttribute Annotation Example

In this page we will learn how to use @ModelAttribute annotation in our spring MVC application. @ModelAttribute binds method parameter or the method response to a named model attribute. @ModelAttribute has an element as value. @ModelAttribute can be used at method level as well as parameter level. The use of @ModelAttribute at parameter level is to accept the value of form from the web request. The one use of @ModelAttribute at method level is assigning values to Model as default. This method will be created in the class annotated with @ModelAttribute. Here we will discuss both approach with example.

Spring MVC Exception Handling and Global Exception Example

Spring provides a robust exception handling framework. We can handle exceptions using @ResponseStatus, @ExceptionHandler, HandlerExceptionResolver and @ControllerAdvice. @ResponseStatus defines a status code for the given exception and can be used at custom exception class level and method level with @ExceptionHandler in controller. In controller class, we can define handler method using @ExceptionHandler and this will be controller specific. To handle exception globally, spring provides @ControllerAdvice that will be available for every controller. Define a class for global exception and annotate it with @ControllerAdvice and we need to define methods using @ExceptionHandler annotation within the class. Spring provides one more approach to handle exception. Use HandlerExceptionResolver in spring XML or java configuration where we can define mappings of exception type and view name. Find the complete example with description.