DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

The Latest Java Topics

article thumbnail
Slowness in Java Application Due To Increased FullGC Events: G1GC
In this article, learn a particular approach to solve the problem when a Java application became slow due to more GC pauses.
April 26, 2022
by Sahil Aggarwal
· 3,994 Views · 6 Likes
article thumbnail
Speeding Up Large Collections Processing in Java
The parallel streams of Java 8 are a straightforward way to improve collections processing. But, other custom parallel strategies may perform better.
Updated April 23, 2022
by Thiago Nascimento DZone Core CORE
· 15,331 Views · 9 Likes
article thumbnail
Visualizing Thread-Safe Singletons in Java
In this article, I will dive deep into the singleton pattern in Java with a multi-threaded environment view.
Updated April 21, 2022
by Nilotpal Sarkar
· 5,299 Views · 7 Likes
article thumbnail
The Most Popular Technologies for Java Microservices Right Now
This article describes the main technical challenges facing modern web applications and lists some frameworks, libraries, and practices used to solve these problems.
April 17, 2022
by Viacheslav Aksenov
· 6,392 Views · 11 Likes
article thumbnail
Memory Leak Due To Improper Exception Handling
In this post, let’s discuss an interesting memory problem we confronted in the production environment and how we went about solving it.
April 4, 2022
by Ram Lakshmanan DZone Core CORE
· 6,402 Views · 12 Likes
article thumbnail
Java Records vs. Lombok
In this article, we will be assessing whether Java Records could replace the Lombok library entirely. Here's what we think.
April 1, 2022
by Gabriel Solano
· 27,988 Views · 34 Likes
article thumbnail
JVM Memory Architecture and GC Algorithm Basics
Overview of JVM memory management (Heap, Stack and MetaSpace) and different Garbage Collection Algorithms
Updated March 30, 2022
by Subhasis Roy
· 19,426 Views · 21 Likes
article thumbnail
Functional Interface Explained in Detail Introduced From Java 8
In this article, explore functional interface introduced in Java 8.
Updated March 29, 2022
by Amit Datta DZone Core CORE
· 68,165 Views · 16 Likes
article thumbnail
Java Development in 2022: Predictions and Selected Trends
In this article, we will try to guess and predict how the industry will face the new challenges, and what innovations and developments will affect it the most.
March 24, 2022
by Alex Belokrylov
· 7,922 Views · 7 Likes
article thumbnail
Error Handling Across Different Languages
To err is human; to return it, divine. At least in C.
March 21, 2022
by Nicolas Fränkel DZone Core CORE
· 4,497 Views · 6 Likes
article thumbnail
The Ultimate Guide on Composite IDs in JPA Entities
This article describes composite IDs in JPA and how to treat them properly. It covers both @EmbeddableID and @IdClass cases and reviews their difference.
Updated March 21, 2022
by Andrey Belyaev DZone Core CORE
· 5,891 Views · 10 Likes
article thumbnail
What Every Java Developer Should Know About Thread, Runnable, and Thread Pool
Most important information about Thread, Runnable, and Thread Pool notions in Java with clear examples, infographics, and explanations.
March 21, 2022
by Dmitry Egorov DZone Core CORE
· 24,972 Views · 22 Likes
article thumbnail
MQTT Messaging With Java and Raspberry Pi
In this article, learn how to send and visualize sensor data using multiple types of Raspberry Pi boards, MQTT, and HiveMQ. Includes video tutorials.
March 18, 2022
by Frank Delporte
· 10,735 Views · 6 Likes
article thumbnail
Blink a LED on a Raspberry Pi With Vaadin
Build a responsive website with Vaadin Flow to control electronic components connected to a Raspberry Pi with Pi4J
March 17, 2022
by Frank Delporte
· 8,199 Views · 9 Likes
article thumbnail
Polymorphism and Dynamic Binding in Java
Learn about polymorphism in Java and the two types: compile-time and runtime. Plus, we take a look at demonstrations of how to achieve static and dynamic binding.
March 17, 2022
by Ankit Dixit
· 9,456 Views · 2 Likes
article thumbnail
What's New With Java 17 and Containers?
Quarkus allows developers to start a new application development based on OpenJDK 17. Read the tutorial below to find out how!
March 16, 2022
by Daniel Oh DZone Core CORE
· 4,643 Views · 5 Likes
article thumbnail
How to Get Started With Vaadin Flow
In this blog, I will show you how I got started with Vaadin Flow. With Vaadin Flow, you can create web apps without HTML or JavaScript, but entirely with Java. Let’s get started! 1. Introduction For some time, I have been curious about Vaadin Flow. I am not very good in frontend developement but sometimes I try to get myself together and then I take a look at a frontend framework. In a previous post, I looked at React for example. Although the React introduction was a nice experience, I still did not think I could create a frontend with React before investing a serious amount of time. At Twitter, I often saw posts coming by about Vaadin and this took my interest. So, I put Vaadin on my blog todo list. A few weeks ago, I started to take a closer look at Vaadin, and more specifically at Vaadin Flow. Reading some blogs and examples, it reminded me about Java Swing but where Java Swing would create a traditional desktop application, Vaadin will create a web application for me. That sounds cool, because now I probably do not have a very steep learning curve and I can continue working in my Java IDE. Besides that, it also seems to integrate quite well with Spring, which I also already know. Enough prerequisites which should lead to a succes story for me. During my research I came up to the following interesting articles: Why I (still) love Vaadin, by Nicolas Fränkel; 5 Reasons Why Enterprises Use Vaadin For Their Web Application UI Needs, by Ankurman Shrestha Vaadin also takes care of the communication between frontend and backend. But when you are using a First API approach, you can call the API from the Vaadin backend part preventing duplication in your code. 2. Vaadin Flow Tutorial The easiest way to get started, is by following the Vaadin Flow Tutorial. Beware that you select the correct version of Vaadin Flow. At the time of writing, Vaadin 14 is the LTS version and is the one you should use when running in production, Vaadin 22 is the latest non-LTS version with new features to experiment with. I am most interested in the current production status and follow the Vaadin 14 Tutorial. The tutorial contains a basic project which you will enhance each time with code snippets which are provided. Also, the concepts and code snippets are clearly explained. Some basic components are used, login is added and it is also shown how you can write tests for the application. The latter is a great advantage because automated testing of a frontend application is always difficult to execute. It takes about 3-4 hours to complete the tutorial, but after that, you already have a good basis for creating your own project. The only disadvantage for me is that the tutorial is mainly copying of code snippets. This way, you miss certain details when trying to use Vaadin Flow yourself. 3. Own Project Let’s see whether I am able to create a frontend for a simple application. The application I create is quite basic and contains of a list of Shows for which ShowEvents can be created. A Show consists out of a title and a ShowEvent consists out of a date and the Show the event is for. The sources for this project can be found at GitHub. I will not explain the entire application, but I will mention some highlights how I built the application. 3.1 Get Started In order to get a quick start, I navigated to start.vaadin.com. Here you can configure the basic setup for the application. I chose an Empty template and added two views: one for the Shows and one for the ShowEvents. In the Settings tab, I changed the Project, the Group ID and decided to use Java 17. When ready configuring, I clicked the Download button and opened the project in my favorite IDE. In the pom, I changed the vaadin dependency to vaadin-core. Reason for this is that I only want to use free components and this should be more than enough for the basic application I want to build. XML com.vaadin vaadin-core ... Next, I wanted to run the application by running the main method of the Application class. Remember, Vaadin integrates well with Spring, so we are talking about a Spring Boot application here. However, this gave the following exception: Shell java.lang.IllegalStateException: The compatibility mode is explicitly set to 'false', but there are neither 'flow-build-info.json' nor 'webpack.config.js' file available in the project/work I was a little too enthusiastic, I had to build the application first. Shell $ mvn clean package After this, the application started successfully. 3.2 Creating the Application I started with creating the data package and copying the AbstractEntity of the tutorial into it. This required adding the spring-boot-starter-data-jpa dependency to the pom. OK, I know I wrote that by copying you miss some details and now I do it myself, but there is nothing wrong with a smart copy now and then. XML org.springframework.boot spring-boot-starter-data-jpa Next, I created the Show and ShowEvent entities and added the JPA repositories. Vaadin also provides a dependency for generating example data. This way, you can generate data into your application for testing purposes. Therefore, I added the exampledata dependency and created the DataGenerator class. XML com.vaadin exampledata 4.1.0 In order to get this working, I had to remove the NotEmpty annotation because of the following exception. I did not investigate this exception any further. Shell No validator could be found for constraint 'javax.validation.constraints.NotEmpty' validating type 'java.time.LocalDate' Next, I created the ShowService and added the H2 database as a dependency to the pom. XML com.h2database h2 Building and starting the application was successfull again and after that, I implemented the ShowsView, ShowEventsView and the ShowEventForm. The first two are for displaying the Shows and ShowEvents into a grid and the ShowEventForm will allow us to change and delete a ShowEvent. To give you an impression, some screenshots are shown here. The Shows page. The ShowEvents page. The ShowEvent form. 3.3 Lazy Loading In the DataGenerator the number of ShowEvents was initially set to 50, but when I increase this to 1000, then a problem occurs in the ShowEvents page. The whole list of ShowEvents is retrieved and loaded into memory. This will get worse when the list grows even further. The solution is provided in the documentation. First, I needed to change to ShowEventRepository by extending it from PagingAndSortingRepository instead of JpaRepository. Java public interface ShowEventRepository extends PagingAndSortingRepository { } Following the instructions of the documentation worked just fine when I scrolled slowly through the list, but when I scrolled a bit faster an IndexOutOfBoundsException was thrown. Shell java.lang.IndexOutOfBoundsException: Index 50 out of bounds for length 50 In order to explain why this exception occurs, we need to take a look at the code for fetching the results. Java private void updateList() { DataProvider dataProvider = DataProvider.fromCallbacks( // First callback fetches items based on a query query -> { // The index of the first item to load int offset = query.getOffset(); // The number of items to load int limit = query.getLimit(); List showEvents = showService.fetchShowEvents(offset, limit); return showEvents.stream(); }, // Second callback fetches the total number of items currently in the Grid. // The grid can then use it to properly adjust the scrollbars. query -> showService.countShowEvents()); grid.setDataProvider(dataProvider); } The offset and the limit (number of items to load) are retrieved from the query provided by Vaadin. However, JPA pagination needs a page and a limit. Therefore, the page needs to be calculated by dividing the offset by the limit. Initially, I just used the offset directly for the page and this caused the error. Java public List fetchShowEvents(int offset, int limit) { return showEventRepository.findAll(PageRequest.of(offset / limit, limit)).stream().toList(); } 4. Conclusion My first experience with Vaadin is quite positive. In most cases, I just need a frontend for an administrator or a limited set of users. With Vaadin I can make use of my Java experience and still provide a fancy web application. Also, the idea that I am able to create tests appeals me a lot. The free components will be most of the time enough for these kind of applications and if not, also some more advanced components are provided by means of a license.
March 16, 2022
by Gunter Rotsaert DZone Core CORE
· 2,657 Views · 2 Likes
article thumbnail
Java on Raspberry Pi
In this post, follow an overview of resources with information and examples of Java projects to control electronic components on the Raspberry Pi.
March 16, 2022
by Frank Delporte
· 9,440 Views · 7 Likes
article thumbnail
Spring Boot: How To Use Java Persistence Query Language (JPQL)
In this Spring Boot video tutorial, take a closer look at how to use Java Persistence Query Language(JPQL), RESTful Web Services.
March 15, 2022
by Ram N
· 4,184 Views · 6 Likes
article thumbnail
How to Configure Selenium in Eclipse
This article discusses how to configure Selenium in Eclipse to use Selenium for Java.
March 11, 2022
by Garima Tiwari
· 4,076 Views · 2 Likes
  • Previous
  • ...
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • ...
  • Next

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: