Overview
Smart-Servlet is a lightweight servlet container based on Jakarta Servlet 6.1 for Java 17 + environments.
Open-source Repositories:
Feature Guidance
This is a solution provided for the WAR package deployment method.
Directorysmart-servlet-bin-${version} main directory
Directorybin
- start.sh Linux environment startup script
- start.bat Windows environment startup script
Directoryconf
- License.shield enterprise authorization certificate
- smart-servlet.properties service configuration file
- smart-servlet.pem SSL certificate
Directorylib/ smart-servlet dependency packages
- …
Directorywebapps directory for deploying WAR packages
- .war
- README.md
Those who have used Spring Boot’s spring-boot-starter-tomcat or spring-boot-starter-undertow should be familiar with this.
smart-servlet-spring-boot-starter is essentially another adaptation of smart-servlet for spring-boot-starter-web.
Simply adjust the pom.xml configuration in your Spring Boot project as follows to replace Spring Boot’s default Servlet container with smart-servlet.
<dependencys> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <!-- Exclude the Tomcat dependency --> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> </exclusions> </dependency> <!-- Use smart-servlet instead --> <dependency> <groupId>tech.smartboot.servlet</groupId> <artifactId>smart-servlet-spring-boot-starter</artifactId> <version>${latest version number}</version> </dependency></dependencys>
This is a usage similar to tomcat-maven-plugin
, typically applied in the local development environment of Java Web projects.
Integrating this plugin requires adding the following code to the pom.xml to start the servlet service in the IDE.
<build> <plugins> <plugin> <groupId>tech.smartboot.servlet</groupId> <artifactId>smart-servlet-maven-plugin</artifactId> <version>${latest version number}</version> <configuration> <port>8080</port> <path>/</path> </configuration> </plugin> </plugins></build>
The plugin version is recommended to be the latest. The main configuration items include:
- port: the listening port for the servlet service to start
- path: the context path of the Servlet container, usually indicated by
/
. Of course, it also supports customization, but it must start with/
.
After completing the configuration, input mvn package smart-servlet:run
in the console.