Build a SpringBook template, which can be downloaded as a service background template for single application.
Project address: https://gitee.com/devilscode/springboot_template
Project Integration Framework
springboot as the basic framework
shiro privilege management
rabbitmq message middleware
redis cache
mybatis persistence layer framework
druid data resources and resource monitoring
swagger Documents API Interfaces
core
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"> <modelVersion>4.0.0</modelVersion> <groupId>com.example.springboot-shiro</groupId> <artifactId>springboot-template</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>springboot-template</name> <description>Spring Boot Shiro</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.4.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <!--redis--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <!--mybatis--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.0</version> </dependency> <!--druid data source--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.0.18</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!--shiro--> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-spring</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>org.apache.shiro</groupId> <artifactId>shiro-ehcache</artifactId> <version>1.4.0</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.2.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-amqp</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <!--log4j--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>log4j-over-slf4j</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
application.yml
server: port: 8080 spring: redis: port: 6379 host: 192.168.139.133 jedis: pool: max-active: 8 min-idle: 0 max-wait: 1ms datasource: type: com.alibaba.druid.pool.DruidDataSource username: root url: jdbc:mysql://192.168.139.133:3306/springboot?useUnicode=true&characterEncoding=utf-8&useSSL=false password: 123456 driver-class-name: com.mysql.jdbc.Driver initialSize: 5 minIdea: 2 maxIdea: 10 maxActive: 20 maxWait: 5 timeBetweenEvictionRunsMillis: 60000 # Configure the minimum lifetime of a connection in the pool in milliseconds minEvictableIdleTimeMillis: 300000 validationQuery: SELECT 1 FROM DUAL testWhileIdle: true testOnBorrow: false testOnReturn: false # Open the PSCache and specify the size of the PSCache on each connection poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 # Configure filters that are intercepted by monitoring statistics, and sql can not be counted after removing them.'wall'is used for firewall filters: stat,wall,log4j # Open mergeSql function by connecting Properties attribute; slow SQL record connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000 # Merging monitoring data from multiple Druid Data Sources useGlobalDataSourceStat: true rabbitmq: host: 192.168.139.133 port: 5672 username: guest password: guest publisher-confirms: true virtual-host: / mybatis: type-aliases-package: com.example.springbootshiro.entity mapper-locations: classpath:mapper/*.xml logging: level: com.geeking.coding.springboot.dao : debug rabbit: config: queue-name: demo-queue exchange-name: demo-exchange routingkey-name: demo-routingkey
Instructions
1: Configure your own data sources (MySql, Redis, RabbitMQ)
2: Start APP.main directly, or configure your own tomcat
Acknowledgement
Thank the developers of the above frameworks for providing our java programmers with such excellent frameworks and tools that we can do things more efficiently.
If the gods feel there is any problem, you can leave a message here or gitee.