当前位置:网站首页>48: Chapter 5: develop admin management service: 1: create sub project [imooc news dev Service Admin], management service module;
48: Chapter 5: develop admin management service: 1: create sub project [imooc news dev Service Admin], management service module;
2022-07-23 23:15:00 【Small withered forest】
explain :
(1) Rationality of this blog :
● stay 【2: Chapter one : Project brief introduction :2: Project presentations ;】 in , We know that part of our project is " Management platform ( Or operation center )"; This is actually , It is the background management system of the project ;
● stay 【9: Chapter two : Architecture back end project :5:【 Polymerization Engineering 】 brief introduction ;】、【3: Chapter one : Project brief introduction :3: Project microservice architecture diagram ;】 in , It is known that we will separate management services ; Background management part of the project , Will be done in this module ;
● therefore , This blog is to create 【imooc-news-dev-service-admin】 management service , This module ;
(2) additional : If it's starting Tomcat and 【admin】 The service , When the port is occupied ; You can refer to 【tomcat When running java.net.BindException: Address already in use: JVM_Bind Error resolution 】 Go and see if the port is occupied , If it is occupied, you can try to close the process that occupies the program ;
Catalog
One :【admin management service 】 part , Description of content ;
Two : Create a subproject 【imooc-news-dev-service-admin】,admin Management service module ;
3、 ... and :【admin】 management service , Initial preparation ;
3.logback-spring.xml: To configure logback The logging component ;
4.Application Main startup class ;
Four :【admin】 management service , Create a test HelloController, See if the project OK;
One :【admin management service 】 part , Description of content ;
(1) structure admin management service ;
(2) Article classification function ;
(3) Link management function ;
(4) User account management ;
(5) The content of the article is reviewed manually ;
● Wait for the back , To develop the " Users publish articles " After function , Then develop this function ;
● After the user publishes the article , There will be an automatic audit first , If the automatic approval fails, the manual approval will be carried out ;
(6)admin Management account number ;
● backstage admin Management Center , You also need an account to log in ; It's just , We will not develop the registration function in the background ; because , Background administrator account , Generally, it is allocated manually ; namely , At the beginning , We will have an administrator account , Then this administrator account can create several administrator accounts , For others to use ;
● Face login will also be involved here ; In limine , It will let users' faces be stored , Then when logging in later , You can use face login ;
Two : Create a subproject 【imooc-news-dev-service-admin】,admin Management service module ;
3、 ... and :【admin】 management service , Initial preparation ;
1.pom.xml;
<?xml version="1.0" encoding="UTF-8"?> <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"> <parent> <artifactId>imooc-news-dev</artifactId> <groupId>com.imooc</groupId> <version>1.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>imooc-news-dev-service-admin</artifactId> <dependencies> <!-- stay admin This micro service , introduce api Dependence of Interface Engineering ; namely 【admin】 This micro service , Need to rely on 【api】--> <dependency> <groupId>com.imooc</groupId> <artifactId>imooc-news-dev-service-api</artifactId> <version>1.0-SNAPSHOT</version> </dependency> </dependencies> </project>explain :
(1) For the time being, only 【api】 The dependence of Interface Engineering ;
2.application*.yml;
(1)application.yml;
############################################################ # # admin Manage microservices # web Access port number Appointment :8005 # ############################################################ server: # port: 8005 tomcat: uri-encoding: UTF-8 max-swallow-size: -1 # tomcat Default size 2M, exceed 2M The file will not be captured , You need to adjust the size here to 100MB perhaps -1 that will do ############################################################ # # Configuration item information # ############################################################ spring: profiles: active: dev # yml in “ The configuration file ” Environment configuration of ,dev Represents the development environment ,test Represents the test environment ,prod Represents the production environment ; application: name: service-admin jackson: date-format: yyyy-MM-dd HH:mm:ss time-zone: GMT+8 datasource: # Configuration of data source type: com.zaxxer.hikari.HikariDataSource # Data source type :HikariCP driver-class-name: com.mysql.jdbc.Driver # mysql drive url: jdbc:mysql://localhost:3308/imooc-news-dev?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true username: root password: ***** hikari: connection-timeout: 30000 # The maximum length of time to wait for the connection pool to allocate the connection ( millisecond ), Connections that have not been available for more than this period of time occur SQLException, Default :30 second minimum-idle: 5 # Minimum connections maximum-pool-size: 20 # maximum connection auto-commit: true # Automatic submission ( This property controls the default auto commit behavior for connections returned from the pool ) idle-timeout: 600000 # Maximum connection timeout ( millisecond ), Timeout is released (retired), Default :10 minute pool-name: DateSourceHikariCP # Connection pool name max-lifetime: 1800000 # The life span of connection ( millisecond ), Time out and not used is released (retired), Default :30 minute 1800000ms connection-test-query: SELECT 1 ############################################################ # # mybatis To configure # ############################################################ mybatis: type-aliases-package: com.imooc.pojo # all POJO Package path of the class mapper-locations: classpath:mapper/*.xml # mapper The mapping file ############################################################ # # mybatis mapper To configure # ############################################################ # Universal Mapper To configure mapper: mappers: com.imooc.my.mapper.MyMapper not-empty: false # During database operation , Judging expressions username != null, Whether to add username != '' identity: MYSQL # dialect , It uses MySQL # Paging plug-in configuration pagehelper: helperDialect: mysql supportMethodsArguments: trueexplain :
(1)admin The port of the management service is 8005, This is the agreement between the front end and the back end ;
(2) The content here , I have introduced it before ; If necessary , You can refer to :
● 【16: Chapter two : Architecture back end project :12: To configure mybatis;( stay 【imooc-news-dev-service-user】 This micro service sub project , To configure )】 Wait for the article ;
(2)application-dev.yml;
server: port: 8005 spring: redis: database: 0 host: 192.168.***.*** port: 6380 password: 12345 # Set domain name , stay java Get in code , Here is resource allocation # here website and domain-name You can write nonsense , As long as you can see the name and know the meaning ; website: domain-name: imoocnews.com # dev Open the development environment mybatis journal mybatis: configuration: log-impl: org.apache.ibatis.logging.stdout.StdOutImplexplain :
(1) The content here , I have introduced it before ; If necessary , You can refer to :
(3)application-prod.yml;
server: port: 8005 spring: redis: database: 0 host: 192.168.223.130 port: 6380 password: 12345 # Set domain name , stay java Get in code , Here is resource allocation # here website and domain-name You can write nonsense , As long as you can see the name and know the meaning ; website: domain-name: imoocnews.com
3.logback-spring.xml: To configure logback The logging component ;
<?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- Specify the storage address of the log file , Using absolute paths --> <!-- <property name="LOG_HOME" value="/workspaces/logs/imooc-news-dev/service-admin"/>--> <property name="LOG_HOME" value="e:/logs/imoocNewsLog/server-admin"/> <!-- Console Output Settings --> <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <!-- Format output :%d Indicates the date ,%thread Represents the thread name ,%-5level: The level is shown from the left 5 Character width %msg: Log message ,%n Is a newline --> <pattern>%white(%d{mm:ss.SSS}) %green([%thread]) %cyan(%-5level) %yellow(%logger{36}) %magenta(-) %black(%msg%n)</pattern> <charset>utf8</charset> </encoder> </appender> <!-- Generate log files per day --> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <!-- The filename of the log file output --> <fileNamePattern>${LOG_HOME}/service-admin.%d{yyyy-MM-dd}.log</fileNamePattern> </rollingPolicy> <encoder> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <!--<logger name="org.apache.ibatis.cache.decorators.LoggingCache" level="DEBUG" additivity="false">--> <!--<appender-ref ref="CONSOLE"/>--> <!--</logger>--> <root level="info"><!-- because debug Log information , That's too much , So we set the output log level to info--> <appender-ref ref="FILE"/> <appender-ref ref="CONSOLE"/> </root> </configuration>explain :
(1) You can refer to 【43: Chapter four : Developing file services :4: Create a subproject 【imooc-news-dev-service-files】, File service module ;】, Contrast ; There are only two changes here :
4.Application Main startup class ;
package com.imooc.admin; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.context.annotation.ComponentScan; import tk.mybatis.spring.annotation.MapperScan; @SpringBootApplication @MapperScan(basePackages = "com.imooc.admin.mapper") @ComponentScan(basePackages = {"com.imooc","org.n3r.idworker"}) public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }explain :
(1)
Four :【admin】 management service , Create a test HelloController, See if the project OK;
(1) First, the whole situation install Look at the whole project ;
(2) start-up 【admin】 The main startup class of the service ;
(3) Remember to open SwitchHost Open virtual domain name mapping ;
……………………………………………………
(4) Through the browser , visit /hello Interface ;
(5) additional : If it's starting Tomcat and 【admin】 The service , When the port is occupied ; You can refer to 【tomcat When running java.net.BindException: Address already in use: JVM_Bind Error resolution 】 Go and see if the port is occupied , If it is occupied, you can try to close the process that occupies the program ;
边栏推荐
- Galaxy Securities opens an account online. Is it safe to open an account on your mobile phone
- 一,数字逻辑的化简
- Entropy weight method to optimize TOPSIS (matlab)
- VIM common shortcut keys
- Redis管道技术/分区
- Mongodb database + graphical tools download, installation and use
- Excel password related
- The role of physical layer, link layer, network layer, transport layer and application layer of tcp/ip model of internet protocol stack
- Remember an experience of being cheated by the Internet
- TAP 系列文章4 | 基于 Backstage 的 TAP 开发者门户
猜你喜欢

Redis管道技术/分区

torchvision.datasets.ImageFolder前的数据整理及使用方法

DHCP: prevent rogue DHCP server in the network

EasyNVR平台如何关闭匿名登录?

Resolved (selenium operation Firefox Firefox browser error) attributeerror: 'webdriver' object has no attribute 'execute_ cdp_ cmd’

The role of physical layer, link layer, network layer, transport layer and application layer of tcp/ip model of internet protocol stack

Niuke C basic exercises
The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)

Tap series article 4 | backstage based tap developer portal

Analytic hierarchy process (matlab)
随机推荐
Excel password related
Extract any page number in PDF file with itextpdf
TOPSIS method (matlab)
Contemporary inspirational "women"
ES6 other syntax and extended syntax summary
1000 okaleido tiger launched binance NFT, triggering a rush to buy
视频号加强打击低俗内容:对违背公序良俗的内容必须赶尽杀绝
Brief analysis of compiling principle of.Net CLR R2R
D2admin framework is basically used
fl studio 20.9更新中文版宿主DAW数字音频工作站
接口测试
Stm32f4 check the frequency of each part of the system
USB转CAN设备在核酸提取仪 高性能USB接口CAN卡
As a developer, you have to know the three performance testing tools JMeter, API and jmh user guide
About: enable delivery optimization in enterprise LAN
疑似未系安全带 林志颖伤势相对稳定
[problem handling] merge made by the 'ort' strategy
QT set cache and compile output path
糖尿病遗传风险检测挑战赛进阶
糖尿病遗传风险检测挑战赛Baseline












