sábado, 16 de mayo de 2020

32. Vaadin 15. New version. Using pnpm instead of npm

1. Introduction
Vaadin proposes to user pnpm instead of npm as it seems quicker and saves disk space.

To achieve this goal one can use several ways, see Vaadin 15 for complete details:
  1. In Spring: in the application.properties file, set this property vaadin.pnpm.enable=true
  2. In a plain JEE application with the @WebServlet annotation (is the one I use)
  3. In a plain JEE application by means of the web.xml file
  4. In the pom.xml file, in the part of the vaadin-maven-plugin

My option is using the @WebServlet annotation, as in my project, I used this class to define the management of internationalization and CDI. Here is the source code


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package openadmin.listeners;

import javax.servlet.annotation.WebInitParam;
import javax.servlet.annotation.WebServlet;

import com.vaadin.cdi.CdiVaadinServlet;
import com.vaadin.flow.server.Constants;

/**
 * Information about app servlet 
 * 
 * Necessary for defining i18n Provider
 * @author ximo 
 *
 */
@SuppressWarnings("serial")
@WebServlet(
	urlPatterns = "/*", 
	name = "slot", 
	asyncSupported = true, 
	initParams = {
		
	// I18N Provider for translation of labels	
        @WebInitParam(name = Constants.I18N_PROVIDER, value = "openadmin.i18n.MyI18nProvider"),
        
        // Enable pmpm instead of npm	
        @WebInitParam(name = "pnpm.enable", value = "true")
 	})


public class ApplicationServlet extends CdiVaadinServlet {
}
  

2 comentarios:

  1. Can you write about Lazy loading and also have you got chance to look into Holon Platform https://docs.holon-platform.com/current/reference/holon-vaadin-flow.html ?

    ResponderEliminar
  2. Hi IIB User,
    thanks for your question.
    Your suggestion is welcome. I didn't know about Holon platform. It looks pretty cool!

    ResponderEliminar