Tomcat Maven Plugin Example
In this maven tutorial, learn to add and configure tomcat plugin to pom.xml and use it deploy the web application without any tomcat installation in machine.
In this maven tutorial, learn to add and configure tomcat plugin to pom.xml and use it deploy the web application without any tomcat installation in machine.
Learn to create Spring MVC controllers and map requests with request mapping annotations e.g. @RequestMapping, @GetMapping, @PostMapping, @PutMapping, @DeleteMapping and @PatchMapping.
In this tutorial, we will learn about Spring’s DispatcherServlet class, it’s responsibilities and how to configure it with examples.
In Spring MVC and Hibernate configuration example, learn to create form-based CRUD application that validates and persists data into database.
Learn to get the Stream of random numbers in Java using the Random and SecureRandom methods ints(), longs() and doubles().
Learn to find min and max date, number, Char, String or object from a stream of items in easy steps using Comparator.comparing().
My requirement was to read the HTTP request body 2 times in servlet filter and the pass the request to filter chain. HttpServletRequestWrapper helped me.
To count the number of elements in stream in Java 8, use either the Stream.count() or Collectors.counting() methods.
To convert primitives intstream or longstream to List, Set or Array, you can adapt one of the following ways given with examples.
In java 8, to convert a stream of primitives to collection, you must first box the elements in their wrapper class and then collect them i.e. boxed stream.
Spring 5 is the first major release, almost four years after Spring Framework 4.0. Lets quickly go through some exciting features coming in Spring 5.0.
Java 9 is bringing lots of new enhancements which are going to affect your programming style and habit, in big way. The biggest change is the modularization of Java. It’s another big change after Lambdas in Java 8. In this article, I am listing down changes which will be part …
JPMS (Java Platform Module System) is the major enhancement in Java 9. It is also known as Project Jigsaw. In this Java 9 modules tutorial, we will learn about modules (in general) and how your programming style will change in future when you will start writing modular code.
JShell allows us to execute Java code snippets and get immediate results without having to create a solution or project or using any code editor.
Date and time handling has always been a pain area for Java developers. The new Date-Time API added in Java 8 changed the way, we interact with date and time in Java. New Date API is a very powerful and much-needed improvement. The only thing missing was, getting a stream …
Learn new Java 9 improvements in Stream API, i.e., the takeWhile / dropWhile, ofNullable, and iterate methods with examples.
Learn to create immutable collections such as immutable list, immutable set and immutable map using new factory methods in Java 9.
Java 9 onward, you are allowed to include private methods in interfaces. Using private methods, now encapsulation is possible in interfaces as well. In this java 9 tutorial, we will learn about interface private methods in detail. Table of Contents Interfaces till Java 7 Static and defaults methods since Java …
Learn to create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework, and add role based security using JAX-RS annotations e.g. @PermitAll, @RolesAllowed or @DenyAll. Table of Contents Project Structure Create REST APIs Secure REST APIs with JAX-RS Annotations Write security filter using JAX-RS ContainerRequestFilter Demo Project Structure The …
Learn to configure and create JAX-RS 2.0 REST APIs using Spring Boot and Jersey framework. This example application uses Jersey’s ServletContainer to deploy the REST APIs.
Learn to install python package in sublime editor for features like autocomplete and run build within sublime editor itself.
Static keyword in java can be applied on variables, methods, blocks, import and inner classes. Learn the effect of using static keyword in detail.
Java constructors are special method-like constructs that allow fully initializing the object state before other classes can use it.
Java Inheritance refers to the ability of a child class to inherit all the non-private properties and methods from the parent class.
In this Lucene 6 tutorial, we will learn to use RAMDirectory to run quick examples of POCs because it is not intended to work with huge indexes.
In Lucene, WildcardQuery can be used to execute wildcard based searches on lucene indexes. Learn to use WildcardQuery with example.
Lucene UnifiedHighlighter is the highest-performing highlighter, especially for large documents. Tutorial to highlight search terms in indexed documents/files.
In Lucene highlighter example, learn to search in documents and highlight search terms in search results using SimpleHTMLFormatter and Fragmenter.
In Lucene 9 example, learn to create indexes from unstructured text files and then search tokens within indexed documents with respective scores of documents.
Learn to compile regular expression into java.util.function.Predicate. This can be useful when you want to perform some operation on matched tokens.
Learn to use Lucene 6 to create, index and search documents using code examples to read, write lucene documents and performing search over them.
JSON.simple is lightweight JSON processing library which can be used to read JSON, write JSON file. Produced JSON will be in full compliance with JSON specification (RFC4627).
JDOM parser can be used to read XML, parse xml and write XML file after updating content of it. It stores JDOM2 document in memory to read xml values.
Learn to read a text file into String using Files.readAllBytes(), Files.lines() and BufferedReader classes in various ways.
Java example to use regular expressions to search and replace unwanted and non-printable characters ASCII characters from text file content.
Since Java 8, in simplest words, the method references are a way to refer to methods or constructors without invoking them. Learn the syntax with examples.
Learn to convert byte[] to String and String to byte[] in java – with examples. Conversion between byte array and string may be used in many cases including IO operations, generate secure hashes etc.
learned to parse a string (decimal, octal and hexadecimal) to int or Integer types using Integer.parseInt(), valueOf() and decode() methods.
In this guide to Java enum with string values, learn to create enum using strings, iterate over all enum values, get enum value and to perform reverse lookup to find enum by string parameter.
Learn to split string by comma or space and store in array or arraylist. Use given Java program to convert string to List in Java.
We may need custom serialization in java in many cases. For example, we have legacy java classes that we are not willing to modify for any reason. There can be some design constraints as well. Or even simply, the class is expected to be changed in future releases which could …
RxJava 2.0 is open source extension to java for asynchronous programming by NetFlix. It is much closer to functional programming as seen in java 8 lambda expressions. The basic building blocks of reactive code are Observables and Subscribers. An Observable emits items; a Subscriber consumes those items.
Maven parent POM (or super POM) is used to structure the project to avoid redundancies or duplicate configurations using inheritance between pom files.
Maven dependency scope is used to specify the visibility of a dependency. It provides six scopes i.e. compile, provided, runtime, test, system, and import.
Maven repositories are physical directories that contain packaged JAR files along with extra metadata. Learn about local, remote and central repositories.
In this Maven tutorial, learn about Maven dependency management, including external dependency, transitive dependency tree, excluding dependencies and version ranges. 1. What is Maven Dependency? In Maven, a dependency is just another archive—JAR, ZIP, and so on—which our current project needs in order to compile, build, test, and/or run. These project dependencies are collectively specified in …
POM (Project Object Model) is an XML file that contains information about the project and configuration details used by Maven to build the project i.e. sourcecode location, project dependencies etc. This file must be named as pom.xml and placed under root folder of project.
Maven settings.xml file contains configurations that are not specific to a project, but are global in nature. It also contains information that is not meant to be distributed (e.g. passwords).
JUnit 5 aims to adapt java 8 style of coding and to be more robust and flexible than JUnit 4. In this post, JUnit 5 vs JUnit 4, we will focus on some major differences between them.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.