Differences

This shows you the differences between two versions of the page.

Link to this comparison view

java:new-app-v3 [14/05/2019 13:53]
Anthony Arents [JSON web tokens]
java:new-app-v3 [11/03/2025 16:51] (current)
Anthony Arents [EXT JS 6]
Line 1: Line 1:
 ====== New Java Web Applications ====== ====== New Java Web Applications ======
  
-**End of life sometime after 2019.** Life will be prolonged by major and minor updates to ALL frameworks and libraries\\+**End of life sometime after 2020.** Life will be prolonged by major and minor updates to ALL frameworks and libraries\\
 (by progressively updating the app whenever a new version comes out for libraries we rely on, we can prevent spending days/weeks/months on a rewrite in the future) (by progressively updating the app whenever a new version comes out for libraries we rely on, we can prevent spending days/weeks/months on a rewrite in the future)
  
Line 12: Line 12:
   * Spring (latest)   * Spring (latest)
   * Spring Security (latest)   * Spring Security (latest)
-  * Hibernate (latest 5.3)+  * Hibernate (latest 5.4)
   * Javamelody (latest, developer tool, used for statistics)   * Javamelody (latest, developer tool, used for statistics)
   * ExtJS (frontend latest) or Bootstrap+JQuery   * ExtJS (frontend latest) or Bootstrap+JQuery
Line 174: Line 174:
         <javax.elapi>3.0.0</javax.elapi>         <javax.elapi>3.0.0</javax.elapi>
                  
-        <spring>5.1.6.RELEASE</spring> +        <spring>5.2.0.RELEASE</spring> 
-        <springsecurity>5.1.5.RELEASE</springsecurity> +        <springsecurity>5.2.0.RELEASE</springsecurity> 
-        <mysql>8.0.16</mysql> +        <mysql>8.0.17</mysql> 
-        <dbcp>2.6.0</dbcp> +        <dbcp>2.7.0</dbcp> 
-        <hibernate>5.4.2.Final</hibernate> +        <hibernate>5.4.6.Final</hibernate> 
-        <hibernate.validator>6.0.16.Final</hibernate.validator> +        <hibernate.validator>6.0.17.Final</hibernate.validator> 
-        <jackson>2.9.8</jackson>+        <jackson>2.10.0</jackson>
         <apache.taglibs>1.2.5</apache.taglibs>         <apache.taglibs>1.2.5</apache.taglibs>
-        <log4j>2.11.2</log4j>+        <log4j>2.12.1</log4j>
         <commons.lang>3.9</commons.lang>         <commons.lang>3.9</commons.lang>
-        <commons.text>1.6</commons.text>+        <commons.text>1.8</commons.text>
         <commons.io>2.6</commons.io>         <commons.io>2.6</commons.io>
-        <commons.beanutils>1.9.3</commons.beanutils>+        <commons.beanutils>1.9.4</commons.beanutils>
         <javax.mail>1.6.2</javax.mail>         <javax.mail>1.6.2</javax.mail>
         <apache.poi>4.1.0</apache.poi>         <apache.poi>4.1.0</apache.poi>
-        <javamelody>1.77.0</javamelody>+        <javamelody>1.79.0</javamelody>
         <findbugs.helper>3.0.2</findbugs.helper>         <findbugs.helper>3.0.2</findbugs.helper>
-        <jsoup>1.11.3</jsoup> +        <jsoup>1.12.1</jsoup
-        <auth0.jwt>3.8.0</auth0.jwt> +        <im4java>1.4.0</im4java
-        <metadataextractor>2.11.0</metadataextractor>+        <auth0.jwt>3.8.3</auth0.jwt> 
 +        <metadataextractor>2.12.0</metadataextractor
 +        <stax2api>4.2</stax2api>
                  
         <maven.compiler.source>1.8</maven.compiler.source>         <maven.compiler.source>1.8</maven.compiler.source>
Line 201: Line 203:
         <report.plugin.maven.inforeports>3.0.0</report.plugin.maven.inforeports>         <report.plugin.maven.inforeports>3.0.0</report.plugin.maven.inforeports>
         <report.plugin.maven.jxr>3.0.0</report.plugin.maven.jxr>         <report.plugin.maven.jxr>3.0.0</report.plugin.maven.jxr>
-        <report.plugin.maven.javadoc>3.1.0</report.plugin.maven.javadoc> +        <report.plugin.maven.javadoc>3.1.1</report.plugin.maven.javadoc> 
-        <report.plugin.maven.checkstyle>3.0.0</report.plugin.maven.checkstyle> +        <report.plugin.maven.checkstyle>3.1.0</report.plugin.maven.checkstyle> 
-        <report.plugin.maven.checkstyle.checkstyleversion>8.20</report.plugin.maven.checkstyle.checkstyleversion>+        <report.plugin.maven.checkstyle.checkstyleversion>8.25</report.plugin.maven.checkstyle.checkstyleversion>
         <checkstyle.config.location>checkstyle.xml</checkstyle.config.location>         <checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
         <report.plugin.maven.pmd>3.12.0</report.plugin.maven.pmd>         <report.plugin.maven.pmd>3.12.0</report.plugin.maven.pmd>
-        <report.plugin.maven.pmd.pmdversion>6.14.0</report.plugin.maven.pmd.pmdversion>+        <report.plugin.maven.pmd.pmdversion>6.18.0</report.plugin.maven.pmd.pmdversion>
         <report.plugin.maven.surefire>3.0.0-M3</report.plugin.maven.surefire>         <report.plugin.maven.surefire>3.0.0-M3</report.plugin.maven.surefire>
         <report.plugin.codehaus.findbugs>3.0.5</report.plugin.codehaus.findbugs>         <report.plugin.codehaus.findbugs>3.0.5</report.plugin.codehaus.findbugs>
Line 212: Line 214:
         <report.plugin.codehaus.versions>2.7</report.plugin.codehaus.versions>         <report.plugin.codehaus.versions>2.7</report.plugin.codehaus.versions>
                  
-        <build.plugin.maven.site>3.7.1</build.plugin.maven.site>+        <build.plugin.maven.site>3.8.2</build.plugin.maven.site>
         <build.plugin.maven.compiler>3.8.1</build.plugin.maven.compiler>         <build.plugin.maven.compiler>3.8.1</build.plugin.maven.compiler>
         <build.plugin.maven.deploy>3.0.0-M1</build.plugin.maven.deploy>         <build.plugin.maven.deploy>3.0.0-M1</build.plugin.maven.deploy>
Line 218: Line 220:
         <build.plugin.maven.install>3.0.0-M1</build.plugin.maven.install>         <build.plugin.maven.install>3.0.0-M1</build.plugin.maven.install>
         <build.plugin.maven.dependency>3.1.1</build.plugin.maven.dependency>         <build.plugin.maven.dependency>3.1.1</build.plugin.maven.dependency>
-        <build.plugin.maven.war>3.2.2</build.plugin.maven.war>+        <build.plugin.maven.war>3.2.3</build.plugin.maven.war>
         <build.plugin.maven.resources>3.1.0</build.plugin.maven.resources>         <build.plugin.maven.resources>3.1.0</build.plugin.maven.resources>
         <build.plugin.maven.surefire>3.0.0-M3</build.plugin.maven.surefire>         <build.plugin.maven.surefire>3.0.0-M3</build.plugin.maven.surefire>
Line 687: Line 689:
  
 This will set most of your dependencies straight, \\  This will set most of your dependencies straight, \\ 
-the parent pom ensures all projects use UTF-8 encoding for files & sets some maven plugins.+Be sure to check the graph to solve the dependency conflicts. \\ 
 +The parent pom ensures all projects use UTF-8 encoding for files & sets some maven plugins.
  
 ==== Checkstyle configuration ==== ==== Checkstyle configuration ====
Line 760: Line 763:
     <!-- See http://checkstyle.sf.net/config_misc.html -->     <!-- See http://checkstyle.sf.net/config_misc.html -->
     <module name="RegexpSingleline">     <module name="RegexpSingleline">
-       <property name="format" value="\s+$"/> +        <property name="format" value="\s+$"/> 
-       <property name="minimum" value="0"/> +        <property name="minimum" value="0"/> 
-       <property name="maximum" value="0"/> +        <property name="maximum" value="0"/> 
-       <property name="message" value="Line has trailing spaces."/>+        <property name="message" value="Line has trailing spaces."/> 
 +    </module> 
 + 
 +    <!-- Checks for Size Violations.                    --> 
 +    <!-- See http://checkstyle.sf.net/config_sizes.html --> 
 +    <module name="LineLength"> 
 +        <property name="max" value="120"/>
     </module>     </module>
  
Line 801: Line 810:
         <module name="UnusedImports">         <module name="UnusedImports">
             <property name="processJavadoc" value="false"/>             <property name="processJavadoc" value="false"/>
-        </module> 
- 
-        <!-- Checks for Size Violations.                    --> 
-        <!-- See http://checkstyle.sf.net/config_sizes.html --> 
-        <module name="LineLength"> 
-            <property name="max" value="120"/> 
         </module>         </module>
         <module name="MethodLength"/>         <module name="MethodLength"/>
Line 891: Line 894:
             <groupId>org.apache.tika</groupId>             <groupId>org.apache.tika</groupId>
             <artifactId>tika-parsers</artifactId>             <artifactId>tika-parsers</artifactId>
-            <version>1.20</version>+            <version>1.22</version>
         </dependency>         </dependency>
 </code> </code>
Line 900: Line 903:
    <groupId>org.hibernate</groupId>    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-search-orm</artifactId>    <artifactId>hibernate-search-orm</artifactId>
-   <version>5.14.0.Final</version>+   <version>5.11.3.Final</version>
 </dependency> </dependency>
 </code> </code>
Line 909: Line 912:
    <groupId>org.hibernate</groupId>    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>    <artifactId>hibernate-validator</artifactId>
-   <version>5.4.2.Final</version>+   <version>5.4.3.Final</version>
 </dependency> </dependency>
 </code> </code>
Line 918: Line 921:
    <groupId>org.hibernate</groupId>    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-validator</artifactId>    <artifactId>hibernate-validator</artifactId>
-   <version>6.0.11.Final</version>+   <version>6.0.17.Final</version>
 </dependency> </dependency>
 </code> </code>
Line 927: Line 930:
    <groupId>org.jsoup</groupId>    <groupId>org.jsoup</groupId>
    <artifactId>jsoup</artifactId>    <artifactId>jsoup</artifactId>
-   <version>1.11.3</version>+   <version>1.12.1</version>
 </dependency> </dependency>
 </code> </code>
Line 1306: Line 1309:
  
     @Override     @Override
-    public void configure(final WebSecurity web) throws Exception {+    public void configure(final WebSecurity web) {
         web.ignoring().antMatchers("/static/**", "/classic/**", "/app/**", "/production/**", "/Merke/**");         web.ignoring().antMatchers("/static/**", "/classic/**", "/app/**", "/production/**", "/Merke/**");
     }     }
Line 5477: Line 5480:
     }</code>     }</code>
 ==== Locale resolver ==== ==== Locale resolver ====
-<code java>package be.mentoringsystems.paypermail.presentation.locale;+<code java CustomLocaleResolver.java>package be.mentoringsystems.merke.presentation.locale;
  
-import be.mentoringsystems.paypermail.model.db.Login; +import be.mentoringsystems.merke.model.db.Login; 
-import be.mentoringsystems.paypermail.service.LoginService;+import be.mentoringsystems.merke.service.LoginService;
 import java.util.Locale; import java.util.Locale;
 import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
 import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.servlet.i18n.CookieLocaleResolver; import org.springframework.web.servlet.i18n.CookieLocaleResolver;
 +import static org.springframework.web.servlet.i18n.CookieLocaleResolver.LOCALE_REQUEST_ATTRIBUTE_NAME;
 +import static org.springframework.web.servlet.i18n.CookieLocaleResolver.TIME_ZONE_REQUEST_ATTRIBUTE_NAME;
  
 /** /**
Line 5494: Line 5499:
     @Autowired     @Autowired
     private LoginService loginService;     private LoginService loginService;
-    +
     @Override     @Override
-    public Locale resolveLocale(HttpServletRequest request) {+    public Locale resolveLocale(final HttpServletRequest request) {
         final Login login = loginService.getCurrentLogin();         final Login login = loginService.getCurrentLogin();
-        if(login != null) { +        if (login != null) { 
-            final Locale locale = new Locale(login.getLanguage()); // can be any other language parameter on login.+            final Locale locale = new Locale(login.getLanguage());
             request.setAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME, locale);             request.setAttribute(LOCALE_REQUEST_ATTRIBUTE_NAME, locale);
             request.setAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME, determineDefaultTimeZone(request));             request.setAttribute(TIME_ZONE_REQUEST_ATTRIBUTE_NAME, determineDefaultTimeZone(request));
Line 5507: Line 5512:
         }         }
     }     }
-     
 } }
 </code> </code>
Line 5518: Line 5522:
 ===== Excel handling ===== ===== Excel handling =====
 ==== ExportController ==== ==== ExportController ====
-<code java>package be.mentoringsystems.merke.presentation;+<code java ExportController.java>package be.mentoringsystems.merke.presentation;
  
 import be.mentoringsystems.merke.model.QueryParams; import be.mentoringsystems.merke.model.QueryParams;
Line 5577: Line 5581:
 </code> </code>
 ==== ExcelView ==== ==== ExcelView ====
-<code java>package be.mentoringsystems.merke.presentation.excel;+<code java VendorRequests.java>package be.mentoringsystems.merke.presentation.excel;
  
 import be.mentoringsystems.merke.model.db.VendorRequest; import be.mentoringsystems.merke.model.db.VendorRequest;
Line 5689: Line 5693:
     }     }
 }</code> }</code>
-<code java>package be.mentoringsystems.merke.presentation.excel;+<code java Vendors.java>package be.mentoringsystems.merke.presentation.excel;
  
 import be.mentoringsystems.merke.model.db.Category; import be.mentoringsystems.merke.model.db.Category;
Line 5803: Line 5807:
 </code> </code>
 ==== ImportController ==== ==== ImportController ====
-<code java>package be.mentoringsystems.merke.presentation;+<code java ImportController.java>package be.mentoringsystems.merke.presentation;
  
 import be.mentoringsystems.merke.importer.VendorImporter; import be.mentoringsystems.merke.importer.VendorImporter;
Line 5877: Line 5881:
 </code> </code>
 ==== Importer Interface ==== ==== Importer Interface ====
-<code java>package be.mentoringsystems.merke.importer;+<code java VendorImporter.java>package be.mentoringsystems.merke.importer;
  
 import java.io.File; import java.io.File;
Line 5887: Line 5891:
  */  */
 public interface VendorImporter { public interface VendorImporter {
 +
     void importFile(final File file, final UUID fileId);     void importFile(final File file, final UUID fileId);
 } }
Line 5894: Line 5899:
 ''values'' is used to import instead of ''result''. Usually importing would be done with the ''result'' map (since it has the column names).\\  In this case the format of imported files varied a lot. ''values'' is used to import instead of ''result''. Usually importing would be done with the ''result'' map (since it has the column names).\\  In this case the format of imported files varied a lot.
  
-<code java>package be.mentoringsystems.merke.importer.excel;+<code java VendorImporterImpl.java>package be.mentoringsystems.merke.importer.excel;
  
 import be.mentoringsystems.merke.importer.VendorImporter; import be.mentoringsystems.merke.importer.VendorImporter;
Line 6152: Line 6157:
 Add ''log4j2.json'' to ''/WEB-INF/'' \\  Add ''log4j2.json'' to ''/WEB-INF/'' \\ 
  
-<code javascript>+<code javascript log4j2.json>
 { {
     "configuration": {     "configuration": {
Line 6183: Line 6188:
 ====== JSP Pages ====== ====== JSP Pages ======
 ===== Login ===== ===== Login =====
-<code html><%@page contentType="text/html" pageEncoding="UTF-8"%>+<code html Login.jsp><%@page contentType="text/html" pageEncoding="UTF-8"%>
 <!DOCTYPE html> <!DOCTYPE html>
 <html> <html>
Line 6282: Line 6287:
 this should be the index.html of your extjs application (slighly modified like :) this should be the index.html of your extjs application (slighly modified like :)
  
-<code html><!DOCTYPE HTML>+<code html index.jsp><!DOCTYPE HTML>
 <html manifest="cache.appcache"> <html manifest="cache.appcache">
 <head> <head>
Line 6359: Line 6364:
 simply place the resource in ''/static/'' or any subfolder there simply place the resource in ''/static/'' or any subfolder there
  
-====== EXT JS ======+====== EXT JS ======
  
 ===== A new App ===== ===== A new App =====