Skip to content

Software Development at Program Tom LTD

Place for coding, programming, development and software in general.

Menu
  • Blog
  • PDF Booklets
  • Dev Utils & Content
  • Java Spring Boot Or Web Apps
  • English
    • български
    • English
    • Español
    • Português
    • हिन्दी
    • Русский
    • Deutsch
    • Français
    • Italiano
    • العربية
  • About Us
Menu
Vaadin Application - Development to Production

Vaadin Application – from Development to Production

Posted on November 29, 2023June 12, 2024 by Toma Velev

You are what you deploy to Production Environment and this is also true if you are doing Vaadin Application Development. Here are some points that I’ve extracted from my experience.

Vaadin Application Development

Vaadin uses Live Reloading and not Hot Reload. In IntelliJ rebuilding is done with Ctrl + F9. After changes the application are reloaded without keeping internal state that is the beast feature of other frameworks like Flutter. The way to have state in some sense – in Vaadin and in Web Applications in General – is the URL and the page, request parameters, query string hash.    

To access URL data from Vaadin Application – your routes need to implement BeforeEnterObserver or HasUrlParameter<String>.

blank

blank

And to add URL paramters, navigation url needs to add them accordingly like this:

UI.getCurrent().navigate("/myloc?test=123");

or via the API

blank

There is a solution – even if you have Components created inline and you need to add them to the tree and change the routing. https://vaadin.com/docs/latest/routing/updating-url-parameters

Common Components

  • Expanded Text in a Layout

Common use cases it to expand a text inside a Horizontal or VerticalLayout and add some additional component. You will find that using the Text class will not work. You will need to use the Span class. This comes from the Web – Block or Inline Tags. Whatever amount abstractions you put, you cannot escape from the limitations of the platform that the application runs on. 

  • https://vaadin.com/docs/latest/components/message-input – Common widget to collect single string value.
  • https://vaadin.com/docs/latest/components/confirm-dialog – Common Component to collect confirmation from the user. It is a must for delete operations.

Uploading File

Common requirement for apps the feature to Upload Files: https://vaadin.com/docs/latest/components/upload. My reccomendation is to use the File Buffer options. You don’t know what files your users will pick up that will overflow the Server’s memory.

Downloading File

There are two options to download File in Vaadin Application.

  • Use standard anchor thag with hrefs /Link/ – pointing to files on the server. These are accessible outside of the Vaadin Session.
  • Use FileDownloader with StreamResource Link https://vaadin.com/docs/v8/framework/articles/LettingTheUserDownloadAFile. These are only accessible from within a Vaadin App.

War vs Jar

If you are coding a Micro Service – running your apps inside docker/kubernetes, etc – you most probably execute your apps as jars. But, if you wish to have it as war – deployed to a jsp/servlet container, here are the changes you need (if you are using maven):

    <packaging>war</packaging>
public class Application extends SpringBootServletInitializer {

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        super.onStartup(servletContext);
       //some custom stuff

    }

Changes in Vaadin Code in the Migration to Production

Vaadin Interprets Front-End Code. To get the code ready for production you need to build it https://vaadin.com/docs/latest/production/production-build. I’ve personally used this: 

mvn clean package -Pproduction -Dvaadin.force.production.build=true

The application may also need these settings in application.properties:

vaadin.productionMode=true
vaadin.servlet.productionMode=true
vaadin.compatibilityMode=false

IP source

If your app needs the user’s IP – in production – your app will most likely run behind load balancer. You need to change the IP origin: https://stackoverflow.com/questions/61249589/need-to-get-the-actual-ip-address-in-vaadin-8-8-5.

  • VaadinRequest.getCurrent().getRemoteAddr() – if the java app is visible
  • VaadinRequest.getCurrent().getHeader("X-Forwarded-For")– if the app is behind load balancer
  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)

Tags

Algorithms (9) crypto (29) flutterdev (39) General (86) Java (7) QR & Bar Codes (3) Software Dev Choices (33) Spring Boot (1) standards (1) Theme (3) User Authentication & Authorization (9) User Experience (10) Utilities (19) WordPress (11)

Product categories

  • All Technologies (87)
    • Flutter Apps (26)
    • GPT (4)
    • Java (39)
    • Native Android (3)
    • PHP (9)
    • Spring (Boot) / Quarkus (36)
    • Utils (15)
    • Vaadin 24+ (28)
    • Vaadin 8 (1)
  • Apps (18)
    • Employees DB (1)
    • Notes (6)
    • Personal Budget (1)
    • Recipes Book (1)
    • Stuff Organizer (1)
    • To-Do (2)
  • PDF Books (3)
  • Source Code Generators (8)

Recent Posts

  • Prompt-to-Production: How AI is Forcing Us to Build Higher Quality Software
  • Debug Web View Flutter App
  • Skipping AI? You’re a Relic – Time to Evolve or Perish!
  • 2026 Flutter Launch Blueprint: Your 10-Step Checklist to App Store Domination
  • Product Requirements Document – for different software development levels

Post Categories

  • Apps (25)
  • ChatGPT (27)
  • Choosing a Framework (38)
  • Flutter (281)
  • Graphical User Interface (14)
  • Marketing (119)
  • Software Development (292)
  • Spring (45)
  • StartUp (22)
  • Uncategorized (14)
  • Uncategorized (4)
  • Vaadin (16)