Spring JavaMelody Tutorial
dev cases | Java development tutorials
by devcases
3y ago
Tutorial describing how to integrate JavaMelody with Spring or Spring Boot 1 application. If we are developing the Spring Boot 2 application, we can use the javamelody-spring-boot-starter as described here. In other case we have to provide own confguration as follows. Technologies used: Spring Boot 1.5.22.RELEASE JDK 1.8 Maven 3 JavaMelody Project setup Project dependencies managed by the Maven’s pom.xml configuration file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:sch ..read more
Visit website
Spring Boot JavaMelody Tutorial
dev cases | Java development tutorials
by devcases
3y ago
Tutorial describing how to integrate JavaMelody with Spring Boot 2 application to monitor application health. Please note that this configuration isn’t compatible with Spring Boot 1 nor plain Spring project. For those project we cannot use the javamelody-spring-boot-starter library with preconfigured JavaMelody beans but should use the javamelody-core dependency and do the configuration ourself like desbribed here. Technologies used: Spring Boot 2.2.1.RELEASE JDK 1.8 Maven 3 JavaMelody Project setup Project dependencies managed by the Maven’s pom.xml configuration file: <?xml version="1 ..read more
Visit website
How to find file in directory
dev cases | Java development tutorials
by devcases
3y ago
In this tutorial we will find out how to find file (by its name) inside the specified directory using different methods and libraries. Java 6 Finding the file inside directory recursively (including subdirectories), the logic of traversing through the directory structure is written manually: public File findFilesInFolderRecursively(File checkedFile, String searchedFilename) { if (checkedFile.getName().equals(searchedFilename)) { return checkedFile; } if (checkedFile.isDirectory()) { for (File file : checkedFile.listFiles()) { File foundFile = findFilesI ..read more
Visit website
How to list all files in the directory
dev cases | Java development tutorials
by devcases
3y ago
In this tutorial we will find out how to list all files and folders in the specified directory. Java 6 Listing all the files and directories in the specified directory (flat structure): public void listFilesForFolder(File directory) { File[] files = directory.listFiles(); for (File file : files) { System.out.println(file); } } Listing all files and directories recursively (including subdirectories): public void listFilesForFolderRecursively(File directory) { for (File file : directory.listFiles()) { if (file.isDirectory()) { listFilesForFolderRecu ..read more
Visit website
How to convert Iterable to Collection
dev cases | Java development tutorials
by devcases
3y ago
In this tutorial we will check java solutions of conversion Iterable to Collection. Java solutions 1. for loop Simple solution that iterates over the elements and adds them into the collection one by one: List<T> list = new ArrayList<T>(); for (T element: iterable) { list.add(element); } 2. while loop In this case we use directly the iterator’s methods (hasNext and get) to control iteration over the elements: List<T> list = new ArrayList<T>();while (iterator.hasNext()) {list.add(iterator.next());} 3. foreach The Java 8 foreach method: List<T> list = new A ..read more
Visit website
Spring Boot CRUD Tutorial with embedded H2 and Freemarker
dev cases | Java development tutorials
by devcases
3y ago
Tutorial describing how to create the simple CRUD (Create Read Update Delete) application using Spring Boot, Freemarker template engine and H2 as embedded database. Technologies used: Spring Boot 2.1.7.RELEASE JDK 1.8 Maven 3 Freemarker JQuery Spring Data JPA H2 database Project setup Project dependencies managed by the Maven’s pom.xml configuration file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.or ..read more
Visit website
Spring Boot CRUD Tutorial with embedded H2 and JSP
dev cases | Java development tutorials
by devcases
3y ago
Tutorial describing how to create the simple CRUD (Create Read Update Delete) application using Spring Boot, JSP template engine and H2 as embedded database. Technologies used: Spring Boot 2.1.7.RELEASE JDK 1.8 Maven 3 JSP Spring Data JPA H2 database Project setup Project dependencies managed by the Maven’s pom.xml configuration file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd ..read more
Visit website
Spring Boot Hello World – Freemarker tutorial
dev cases | Java development tutorials
by devcases
3y ago
Tutorial describing how to create the simple Hello World application using Spring Boot and Freemarker template engine. Technologies used: Spring Boot 2.1.7.RELEASE JDK 1.8 Maven 3 Freemarker Project setup Project dependencies managed by the Maven’s pom.xml configuration file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> ..read more
Visit website
Spring Boot Hello World – JSP tutorial
dev cases | Java development tutorials
by devcases
3y ago
Tutorial describing how to create the simple Hello World application using Spring Boot and JSP. Technologies used: Spring Boot 2.1.7.RELEASE JDK 1.8 Maven 3 JSP Project setup Project dependencies managed by the Maven’s pom.xml configuration file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <gr ..read more
Visit website
How to debug maven tests
dev cases | Java development tutorials
by devcases
3y ago
The problem usually occurs when you don’t have a possibility to run tests by your IDE (where there is a built in support of debugger), but you have to debug the failing test remotely. The command we should use should be: mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -Djava.compiler=NONE" Test The property maven.surefire.debug of the Surefire Plugin configures the behaviour of the debugger during the execution the test phase. The above command use the Java Debug Wire Protocol (JDWP) to connect to the maven java process. Then we can use the j ..read more
Visit website

Follow dev cases | Java development tutorials on FeedSpot

Continue with Google
Continue with Apple
OR