springboot oriental (tongweb) replace tomcat

Time:2024-2-8

I. Modify pom.xml file dependencies

1. Excluding built-in tomcat dependencies in springboot
2. Add tongweb-spring-boot-starter and tongweb-embed dependencies
Special note: I have all the dependent packages passed to the private repository, directly copying to the pom.xml file will fail to import.

<! -- SpringBoot Web Container -->
<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
   <! --- Exclude self-contained tomcat dependencies -->
   <exclusions>
       <exclusion>
           <groupId>org.springframework.boot</groupId>
           <artifactId>spring-boot-starter-tomcat</artifactId>
       </exclusion>
   </exclusions>
</dependency>
<! -- Add tongweb-spring-boot-starter dependency -->
<dependency>
    <groupId>com.tongweb.springboot</groupId>
        <artifactId>tongweb-spring-boot-starter-2.x</artifactId>
            <version>7.0.E.5</version>
</dependency>
<! -- Add embedded version of TongWeb dependency -->
<dependency>
    <groupId>com.tongweb</groupId>
        <artifactId>tongweb-embed</artifactId>
            <version>7.0.E.5</version>
</dependency>
<dependency>
    <groupId>com.tongweb</groupId>
    <artifactId>tongweb-javax-servlet</artifactId>
    <version>4.0.0</version>
</dependency>
<dependency>
    <groupId>com.tongweb</groupId>
    <artifactId>tongweb-embed-servlet</artifactId>
    <version>7.0.E.5_P2</version>
</dependency>
<dependency>
    <groupId>com.tongweb</groupId>
    <artifactId>tongweb-embed-javax</artifactId>
    <version>7.0.E.5_P2</version>
    <scope>compile</scope>
</dependency>
<dependency>
    <groupId>com.tongweb</groupId>
    <artifactId>tongweb-javax-security-auth-message-api</artifactId>
    <version>1.1.0</version>
</dependency>

2. Modify the application.yml file

1. Comment out the original tomcat related configuration
2. Add tongweb related configurations
3 Add the local authentication configuration of tongweb, and put the authentication file license.dat into the resources folder.
When the configuration item server.tongweb.license.type = file, it means that the license authentication method is local authentication.
The path where the configuration file is stored is determined by the configuration item server.tongweb.license.path.

server:
#  tomcat:
# # tomcat URI encoding
#    uri-encoding: UTF-8
# # tomcat maximum number of threads, the default is 200
#    max-threads: 800
# # The number of threads initialized by Tomcat startup, default value 25
#    min-spare-threads: 30
  tongweb:
    license:
      type: file
      path: classpath:license.dat
    uri-encoding: utf-8
    max-threads: 800

III. Problems encountered

According to the official document to add dependencies, start the project failed, check the last error: ClassNotFoundException, a class can not be found, there should be a package is not imported, check the official zip package to find the missing package (pom.xml file to add the last four dependencies), increase the dependency, the project is normal to start.
springboot oriental (tongweb) replace tomcat

Recommended Today

JavaWeb Framework: Introduction to Spring MVC

Spring MVC summarize summarize MVC (Model View Controller), as a design pattern for layered development of applications. Spring MVCSpring MVC provides a front-end controller DispatcherServlet to dispatch requests , and then through the configuration of the handler mapping , view parsing , etc., to make the MVC pattern development more efficient . Spring MVC five […]