In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I will talk to you about how to analyze the framework building process of SpringBoot multi-module project, which may not be well understood by many people. In order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.
To create the root project, New Project creates a new SpringBoot project named sms-bomber and packaged as JAR. Here, only Lombok and spring-boot-starter-web dependencies are added, which are passed to all sub-modules. Delete .mvn\ src\ mvnw mvnw.cmd in the created project.
To create a startup module, right-click New-> Model on the project name of the root directory to select Maven type. Do not select the create from archetype,Parent attribute to select the root project you just created. First create a module of ${PREFIXE}-start to start the project. Create the start module under the resources directory.
Server: servlet: # Project context path context-path: / sms-bomberspring: main: # close banner banner-mode: off profiles: # Test Environment active: dev-mysql # production Environment # active: prod-mysql
And logback.xml.
% d {HH:mm:ss.SSS} [% thread]%-5level% logger {36} -% msg%n% d {HH:mm:ss.SSS} [% thread]%-5level% logger {36} -% msg%n utf-8 ${logfile-dir} / ticket.log ${logfile-dir} / ticket.%i.log 1 5 1MB
Create a project startup class
Package com.seliote.smsbomber;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;/** * Project launch class * * @ author LiYangDi * @ since 2020-1-26 * / @ SpringBootApplication (scanBasePackages = "com.seliote.smsbomber") public class Application {public static void main (String...) Args) {SpringApplication.run (Application.class, args);}}
Create a Servlet initialization class
Package com.seliote.smsbomber;import org.springframework.boot.builder.SpringApplicationBuilder;import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;/** * initialize Servlet with WAR package * * @ author LiYangDi * @ since 2020-1-26 * / public class ServletInitializer extends SpringBootServletInitializer {@ Override protected SpringApplicationBuilder configure (SpringApplicationBuilder builder) {return builder.sources (Application.class);}}
Modify the startup class of IDEA and try to start the project
Change the packaging mode of startup module to war, and add war and war under the pom.xml,project node of startup module.
Org.springframework.boot spring-boot-maven-plugin sms-bomber
Build a TestCtr,maven package and throw the war into the Tomcat to experience it.
Create module persistence, service, web, common layer module layer module, and configure related dependencies. Add dependency project node in root project pom.xml, and then add it in turn.
Com.seliote sms-bomber-common ${sms-bomber.version} com.seliote sms-bomber-persistence ${sms-bomber.version} com.seliote sms-bomber-service ${sms-bomber.version} com.seliote sms-bomber-web ${sms-bomber.version} com.seliote sms-bomber-start ${sms-bomber.version} org.mariadb.jdbc mariadb-java-client ${mariadb.version}
Add under the dependencies node for global module usage
Com.seliote sms-bomber-common
Version definitions such as ${sms-bomber.version} are defined under the properties tag
Add dependencies under pom.xml of persistence module
Org.mariadb.jdbc mariadb-java-client runtime org.springframework.boot spring-boot-starter-data-jpa
Add service module under pom.xml
Com.seliote sms-bomber-persistence
Add web module under pom.xml
Com.seliote sms-bomber-service
Add start module under pom.xml
Com.seliote sms-bomber-web
Configure SpringDataJpa
Add under dev yml
Spring: datasource: driver-class-name: org.mariadb.jdbc.Driver url: jdbc:mariadb://127.0.0.1:3306/sms_bomber username: sms_bomber password: 123456% ^ qp jpa: database-platform: org.hibernate.dialect.MariaDB103Dialect open-in-view: false show-sql: true
After reading the above, do you have any further understanding of how to analyze the framework building process of SpringBoot multi-module project? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.