Summary of Spring Boot actual combat project

Keywords: git Database xml Spring

Summary of Spring Boot actual combat project (1)

Project design ideas (steps)
Development environment construction and log
git common commands
Learning methods
List of projects available for reference

1, Project design ideas (steps)
1. Analysis function: what are the functions and application scenarios of different roles
2. Technical analysis: technical selection for different functions
3. Design steps:
Role division - > relationship diagram - > functional module division - > database table design - > Technical Framework Design - > deployment architecture
2, Development environment construction and log
1. Development environment - IDEA, redis\mysql generated by docker image
The database comment field is designed as utf8m64 to store emoj expression
+ IDEA shortcut summary:
Ctrl+shift+r workspace search
Click the class file on the left, and then shift+F6 to rename the class name
Click the left class package, and then alt+insert to create a new class shortcut key
Ctrl+shift+T add unit test
Ctrl+shift+U all uppercase shortcut
Alt+shift + ↑ move code up
Ctrl+Alt+B view implementation class
Search keywords in Ctrl+shift+R workspace
2. log: log4j2 log is recommended (link). Here is the configuration of logback.xml
resources/logback-spring.xml configuration:

<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
 <appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">
  <layout class="ch.qos.logback.classic.PatternLayout">
   <pattern>
    %d - %msg%n
   </pattern>
  </layout>
 </appender>
 <appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <file>/jupiterx/sell/logs/sell.info.log</file>
  <encoder>
   <pattern>
    %d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}} - %msg%n
   </pattern>
  </encoder>
  <filter class="ch.qos.logback.classic.filter.LevelFilter">
   <level>ERROR</level>
   <onMatch>DENY</onMatch>
   <onMismatch>ACCEPT</onMismatch>
  </filter>
  <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
   <fileNamePattern>/jupiterx/sell/logs/sell.info.%d.log.%i.zip</fileNamePattern>
   <!-- If you roll back by day, the maximum save time is 365 days, and the ones before 365 days will be cleaned up -->
   <maxHistory>1</maxHistory>
   <!-- The total storage amount of log is 10 GB -->
   <totalSizeCap>1GB</totalSizeCap>
   <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    <!--File up to 128 MB Will be compressed and cut -->
    <maxFileSize>2KB</maxFileSize>
   </timeBasedFileNamingAndTriggeringPolicy>
  </rollingPolicy>
 </appender>
 <appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
  <file>/jupiterx/sell/logs/sell.error.log</file>
  <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
   <level>ERROR</level>
  </filter>
  <encoder>
   <pattern>%d - %msg%n</pattern>
  </encoder>
  <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
   <fileNamePattern>/jupiterx/sell/logs/sell.error.%d.log.%i.zip</fileNamePattern>
   <!-- If you roll back by day, the maximum save time is 365 days, and the ones before 365 days will be cleaned up -->
   <maxHistory>1</maxHistory>
   <!-- The total storage amount of log is 10 GB -->
   <totalSizeCap>1GB</totalSizeCap>
   <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    <!--File up to 128 MB Will be compressed and cut -->
    <maxFileSize>2KB</maxFileSize>
   </timeBasedFileNamingAndTriggeringPolicy>
  </rollingPolicy>
 </appender>

 <root level="info">
  <appender-ref ref="consoleLog"/>
  <appender-ref ref="fileInfoLog"/>
  <appender-ref ref="fileErrorLog"/>
 </root>
</configuration>

3, git common commands (to be added)
git clone https://...
Git check out - B 5-1 (local branch name) 5-1 (remote branch name)
Git check out 6-1

4, Learning methods
1. Recorded code fragment
2. Confirm the development environment, develop objectives and analyze business
3. Write the annotation code first, and then write the code after thinking about the logic

5, List of projects available for reference

com.xxx.project
    - aspect section
    - config To configure
    - constant constant
    - controller Receive request class
    - converter Transformation class
    - po Entity class
    - dto Transport object
    - enums Enumeration class
    - exception Exception handling class
    - form Form auto mapping+Validation class
    - handler Processing class
    - repository Database persistence operation interface
    - service Business logic processing interface
    - utils Tool class
    - VO Back to front Json Object class
    ApplicationMain.class


                
    

93 original articles published, 32 praised, 60000 visitors+
Private letter follow

Posted by Paingiver on Tue, 25 Feb 2020 19:01:18 -0800