So how do I set a Thymeleaf template resolver for my springboot webapp then - maven

I built a spring-boot webapp with a single home.html file under src/main/resources/template and when I return "home" from my spring controller it works perfectly. I'm packaging it as a war and it runs wonderfully with spring-boot's embedded tomcat server. If I run it with mvn spring-boot:run, that is.
But later if I start my application with java -jar myjar.war it claims the server has started up and all is well, but when I try to access it at localhost:8080 it fails with:
Error resolving template "home", template might not exist or might not be accessible by any of the configured Template Resolvers
So what do I have to do next then?
This is my pom.xml, by the way:
<groupId>com.ciber</groupId>
<artifactId>energyworx-conversion-tool</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
</parent>
<properties>
<java.version>1.7</java.version>
<start-class>com.ciber.ewct.WebApp</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Xlint:all</compilerArgument>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<!-- <jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000</jvmArguments> -->
</configuration>
</plugin>
</plugins>
</build>
After turning debug logging level on, I see this about thymeleaf configuration, which is the same for when I run it with mvn spring-boot:run and java -jar:
[THYMELEAF] * Cache Factory implementation: org.thymeleaf.cache.StandardCacheManager
[THYMELEAF] * Template modes:
[THYMELEAF] * LEGACYHTML5
[THYMELEAF] * XHTML
[THYMELEAF] * HTML5
[THYMELEAF] * VALIDXML
[THYMELEAF] * VALIDXHTML
[THYMELEAF] * XML
[THYMELEAF] * Template resolvers (in order):
[THYMELEAF] * org.thymeleaf.templateresolver.TemplateResolver
[THYMELEAF] * Message resolvers (in order):
[THYMELEAF] * org.thymeleaf.spring4.messageresolver.SpringMessageResolver
[THYMELEAF] * Dialect [1 of 2]: org.thymeleaf.spring4.dialect.SpringStandardDialect
[THYMELEAF] * Prefix: "th"
[THYMELEAF] * Dialect [2 of 2]: nz.net.ultraq.thymeleaf.LayoutDialect
[THYMELEAF] * Prefix: "layout"
[THYMELEAF] TEMPLATE ENGINE CONFIGURED OK

I'm sad to say that you are actually doing it wrong.
You configured your build to exclude the webapp server from your package.
<packaking>war</packaging>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
With this setup, you have a war that can be deployed inside an existing Servlet container. You won't be able to start your app with a java -jar command.
If you want to run you webapp with a java command line. Replace your packaging to jar and remove the provided instruction from your pom.
<packaking>jar</packaging>
...
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
-->
Then you will have an embedded tomcat inside your jar and the command java -jar myjar.jar will properly.
Edit : Finally, I would raise the log level on Spring Web package to see how the Template Resolver tries to lookup your template.
Regards,
Daniel

I seem to have fixed it, with #DanielLavoie's help, by reverting all the changes I made to make the application a deployable war.
Those were:
remove the <packaking>war</packaging> so that a jar is generated instead;
remove <scope>provided</scope> from the dependency spring-boot-starter-tomcat;
remove extends SpringBootServletInitializer from my Application class;
I don't like the solution because according to the documentation I followed you'd be able to make the war deployable and also standalone enabled. But it'll have to do for now.

Related

Liferay 6.2 is not deploying my jar files

I need to modify and deploy some liferay modules that I didn't write. The original developer is not with the company anymore and there's almost no documentation on the code. The project is structured differently to the liferay projects I'm familiar with, so I'm struggling with the deployment.
It's a maven project with a number of modules, and when I build it generates multiple jar files. When I copy one of those jar files to my local deployment folder Liferay prints something like:
13:07:23,201 INFO [com.liferay.portal.kernel.deploy.auto.AutoDeployScanner][ModuleAutoDeployListener:70] Module for /Users/ali/LIFERAY/liferay-portal-6.2-ee-sp14/deploy/com.monator.ehp.routes.servicemix.moci-1.6.1.jar copied successfully. Deployment will start in a few seconds.
... and then nothing. If I check the liferay/data/osgi/modules/ directory I do see the jar file is present there, however when I test the behaviour I do not see my changes reflected, even after restarting the tomcat server.
We're running Liferay 6.2 ee sp14 with tomcat and postgres. I believe the modules in question are osgi modules, but I don't think that changes the deployment method?
EDIT: This is the main project pom file, running "mvn install" in the same directory does not create a war file, but does create multiple individual jar files in the various child module folders:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.monator.tools</groupId>
<artifactId>monator-parent</artifactId>
<version>0.7.0</version>
</parent>
<groupId>com.monator.clients.moh</groupId>
<artifactId>camel-routes</artifactId>
<version>1.6.1</version>
<packaging>pom</packaging>
<name>Camel Route Project Parent</name>
<scm>
<url>https://bitbucket.org/monator/ehealth-portal-camel-routes.git</url>
<connection>scm:git:ssh://git#bitbucket.org/monator/ehealth-portal-camel-routes.git</connection>
<developerConnection>scm:git:ssh://git#bitbucket.org/monator/ehealth-portal-camel-routes.git</developerConnection>
</scm>
<modules>
<module>servicemix.routes.parent</module>
<module>liferay.routes.parent</module>
</modules>
<properties>
<camel.version>2.13.2</camel.version>
<osgi.export.package></osgi.export.package>
<osgi.import.package>*</osgi.import.package>
<osgi.bundle.symbolic.name>${project.groupId}.${project.artifactId}</osgi.bundle.symbolic.name>
</properties>
<build>
<finalName>${osgi.bundle.symbolic.name}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${osgi.bundle.symbolic.name}</Bundle-SymbolicName>
<Export-Package>${osgi.export.package}</Export-Package>
<Import-Package>${osgi.import.package}</Import-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<!-- Dependencies only declared for IDE support -->
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.aries.blueprint</groupId>
<artifactId>org.apache.aries.blueprint.cm</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-osgi</artifactId>
<version>5.10.0</version>
<!-- Since we're using Maven 3, this is necessary. -->
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>```
Liferay 6.x can deploy war files, not jars!
Maybe your maven projects builds many jars for then build a war file?
Better if you post the pom.xml and the internet crew try to understand the mistery..
EDIT:
This project build osgi jars for Apache Camel to create some custom routes! https://camel.apache.org/ , there are not Liferay modules!
(Maybe Liferay plays as Camel consumer/producer?)

WEB-INF not getting added to SpringBoot jar

I'm putting together a webapp using SpringBoot.
The REST part works fine, but the "JSP part" is borked. The endpoints are called, everything is fine until I return the basename of the JSP page, such as return "info"; The method returns a String.
When I invoke an endpoint, I get this message:
[...] [dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Could not resolve view with name 'info' in servlet with name 'dispatcherServlet'] with root cause
javax.servlet.ServletException: Could not resolve view with name 'info' in servlet with name 'dispatcherServlet'
I followed "the pattern" for adding JSP support to SpringBoot (I say "the pattern" because the dozen or so sources I found all seem to quote the same example).
I'm building a JAR with Maven, looking into that jar, I don't find the JSP files, or even any of the WEB-INF directory structure, so I believe the problem is somewhere between Maven and SpringBoot's plugin.
Here are the pieces of the POM, most of the dependencies removed:
<packaging>jar</packaging>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
...
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
The POM was built mostly from an archetype.
I'm rather ignorant about debugging Maven builds, assuming that this is a Maven problem, however, I suppose it could have something to do with the springboot plugin. I appreciate all assistance, include better resources to read than the ones that I found.
UPDATE
Per Qiu Zhou's comment about the , I added the following to the POM:
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
and moved the JSP directory to src/main/resources/WEB-INF/jsp. The JAR file now contains this:
BOOT-INF/classes/WEB-INF/jsp/info.jsp
which seems to be correct. I no longer get the dispatcherServlet message (see above), however, when I curl the site, this is what I get:
% curl localhost:8099/info
{"timestamp":"2020-09-01T17:22:28.413+00:00","status":404,"error":"Not Found","message":"","path":"/info"}
The controller code is this:
#Controller
public class SimpleController {
#GetMapping("/info")
public String info() {
return "info";
}
}
I remain perplexed -- Is the JAR built correctly??
Thanks
You are not specifying the version of the plugin you wish to use. Depending on the version you might need to configure the plugin to add the resources directory to the application classpath by adding the following to the plugin configuration
<configuration>
<addResources>true</addResources>
</configuration>
This enables hot reloading of resources, but what is actually recommended now for this and other development features is adding spring dev tools dependency.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.3.3.RELEASE</version>
<optional>true</optional>
</dependency>
</dependencies>
You can learn more about it by reading the plugin docs.
https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/html/#run
khmarbaise provided a solution in his comment - which was to package the JAR as a WAR. I waited for him to post an answer v. a comment, but its been quite a while, so I will answer on his behalf.
try following steps:
1、include jstl dependency:
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
2、put your jsp files in src/main/webapp/WEB-INF/jsp directory. (manually create it if does not exist)
3、set view prefix in application.properties or application.yml:
spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
4、specify where jsp files should be in output, put following config in pom.xml(based on the your config):
<packaging>jar</packaging>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
...
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>

common-data maven project needs to be included in two spring boot application

i have three projects
common-data : separate maven java project
application-1 : spring boot app
application-2: spring boot app
i want to include that common data project in both application-and application-2 as dependency.
but when i am adding that dependency in application-1 spring boot project is started but not running .
http://localhost:8090/hello this is end point: when included dependency of common data in any of application i am getting 404 found error.
<dependencies>
<!-- Add typical dependencies for a web application -->
<!-- Adds Tomcat and Spring MVC, along others -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.stocksrin</groupId>
<artifactId>stocksrin-common</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
now this is not working
You can do this way:
Step 1: Edit dependency org.stocksrin:
<dependency>
<groupId>org.stocksrin</groupId>
<artifactId>stocksrin-common</artifactId>
<version>1.0.0</version>
<scope>system</scope>
<systemPath>${basedir}/lib/stocksrin-common.jar</systemPath>
</dependency>
${basedir} : PROJECT ROOT FOLDER
Step 2: you can set 'includeSystemScope' to true:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>

Jmeter random function is not working from java application

I want to make use of Jmeter Random function (${__RandomString(10,0123456789,Value)}) in my java application for load testing.
Below is maven dependency
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_functions</artifactId>
<version>4.0</version>
</dependency>
It is working properly If I add ApacheJMeter_functions jar to class path but the same is not working if I use Maven dependency.
Note : Works fine if I add jar to classpath without version name.
pom :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>performance-api</artifactId>
<version>0.1</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_functions</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Response when added ApacheJMeter_functions jar to class path without version name
Response when added ApacheJMeter_functions dependency jar into pom
Below solution helped me in resolving issue
When Jmeter functions are used in the Java code, Jmeter tries to compare the function related classes from java class path with classes from the 'search_path' (Reads classes from the jars). So Jmeter function works only if required function class is present in both the path (Jmeter has seperate class for each function).
This is why we need to make sure the 'ApacheJMeter_functions' jar added in the pom (which will be added in class path ) and the path to jmeter functions jar is set to 'search_path'.Both should have same version.
But in case of spring boot application, along adding dependency to pom we also need to append the path to jmeter functions jar explicitly to the class path like below
System.setProperty("java.class.path", System.getProperty("java.class.path") + PathToJmeterFunctionJars );

Maven Not Compiling the java files

This is My Folder structure -
![Project explorer][1]
--project>
--src
--main
--java
--resource
--target
pom.xml
This is My Pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mkyong</groupId>
<artifactId>spring-security-loginform-xml</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>SpringSecurity Custom Login Form XML</name>
<url>http://www.mkyong.com/tutorials/spring-security-tutorials/</url>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>mkyong</id>
<name>Yong Mook Kim</name>
<email>mkyong2002#gmail.com</email>
</developer>
</developers>
<properties>
<jdk.version>1.6</jdk.version>
<spring.version>3.2.8.RELEASE</spring.version>
<spring.security.version>3.2.3.RELEASE</spring.security.version>
<jstl.version>1.2</jstl.version>
</properties>
<dependencies>
<!-- Spring 3 dependencies -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.version}</version>
</dependency>
<!-- jstl for jsp page -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
</dependencies>
<build>
<finalName>SpringSecurityHelloWorld</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${basedir}/src</sourceDirectory>
</build>
</project>
While i am going to modify the code in java file or the controller those are not effecting while I am running the project. I think Maven is not compiling the Java code.
Is the folder structure is correct ?
Where the class files are generated in the project ?
Can any one suggest with explanation.
Based on your question and the comments below it I try to give you a answer:
is the folder structure correct?
Yes ist is. It follows the Maven standard directory structure described here: http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
It however misses a webapp-folder (see next point) which will not make your build fail but end in a war not containing a WEB-INF folder - hence it is not a standard webbapplication as defined by the Java EE standard (http://docs.oracle.com/javaee/6/tutorial/doc/bnadx.html).
Where are the class files generated in the project?
After maven runned the phase compile (mvn compile) of the default lifecycle (http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html) the compiled class files will be placed under /target/classes.
If you continue to the phase package (mvn package) maven will build a war (jar is the default packaging type which was overwritten in your pom) containing your classes as well as your resources which is placed under /target
Note: If you are building a webapplication you place your website's content such as a deployment descriptor (web.xml) or HTML/JSP/JSF pages etc. under a folder src/main/webapp (the WEB-INF folder should be under src/main/webapp/WEB-INF).
Regarding the comments disscussion
If you expect to see changes in Java files on the fly Maven will not support you out of the box. Maven is a build tool - e.g. if you change something in your project you will request maven to build the project again to have the changes ready in a deployable form (e.g. you have a war file in your /target folder which you can then deploy).
If you want to see changes on the fly you should try a websearch for topics such as Hotdeployment, JRebel, embedded jetty since there are quite a few options available to archive this.
One general approach to have hotdeployment "out of the box" is to point the exploded directory of a hotdeploy-supported (web)(application) server to the exploded directory of your maven build. Right on the same level as you will find your spring-login-security-xml.war the is a folder spring-login-security-xml which contains the unpacked webapplication. This will however not spare you to have a build per change.
This is the first issue that popped up for me when my class files were not being generated. My fix does not apply to this question, but I'm mentioning it here in case it helps someone else.
I had a quick copy and paste setup with a single top level pom.xml. In it I had set
<packaging>pom</packaging>
which caused the java files to be ignored. The fix was to remove the packaging tag, letting it default to jar.

Resources