When I try to dump the table with the mysqldump command I got the error message. The dump command and the error message are here.
Before Java8 if you need convert list to map you have to iterate over the list. Java8 provide stream to help you iterate over the list. You can convert list to map by using stream with only one line of code.
Spring Data KeyValue framework use java.util.Map to store data in memory. I will show you how use it in this page.
The isAssignableFrom method is used to judge the relationship of two classes. This method can tell you whether A is the subclass of B. or A class implement B interface. The example code is here.
The code in finally block will always be executed except invoke System.exit() method. The example code is like following.
This is a sample example to quick start to use spring data framework. I assume you have created a Mysql database which name is db. For quick start we only save data into database and query them out without any condition.
So many books, so little time.
As we all know, JVM will do garbage collection when there is not enough memory to use. You can use System.gc() in your code to trigger garbage collection. But when JVM does this is not uncertainty.
There are many ways to handle the exception in Spring Boot. You can click Spring Boot exception handler example or Spring Boot global exception example to see how to handle exception in controller or handler. I will show you how to handle exception by implementing HandlerExceptionResolver.
Let's say you have a list of string and you want to add separator to them. If you use JDK8+ you can use String.join(). For JDK7-, I recommend you to use StringUtils in apache-commons-lang. The code is like following.
Today I got NoClassDefFoundError when I test my new feature. The stack information is like following.
I have shown you how to handle exceptions in controller. Click here for more detail. You can use @ControllerAdvice to define a global handler. This handler is for handling global exceptions. The structure of this example project is like following.
Thymeleaf is a Java template engine. In this page I will show you how to use it in Spring Boot. You can use it to display the page. The structure of project is like following.
In this page I will show you how to use ExceptionHandler annotation handle exceptions. The structure of project is like following.
We use cat command to combine multiple files into one. Here are the examples. Let's say you have 3 files like following.