springboot2.x整合shiro、mybatis、redis的配置文件

本文详细介绍了如何在Spring Boot 2.1.7环境中使用mybatis-spring-boot-starter、druid数据库连接池和Swagger进行API文档生成,包括排除特定依赖及部署配置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

此处的springboot的版本为"2.1.7.RELEASE"。
“pom.xml”

<!-- springboot的父类依赖  -->
  <parent>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-parent</artifactId>
      <version>2.1.7.RELEASE</version>
  </parent>
  
  <dependencies>
 		<!-- web -->
    	<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
            	 <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>        
        </dependency>
    	
		<!-- tomcat -->
  		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
			<scope>provided</scope>
		</dependency>
  		
        	
		<!-- mybatis -->
		<dependency>
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>1.3.1</version>
		</dependency>
		
		
		<!-- MySQL -->
		<dependency>
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<version>8.0.11</version>
		</dependency>
		
		<!-- druid数据库连接池 -->
		<dependency>
			<groupId>com.alibaba</groupId>
			<artifactId>druid-spring-boot-starter</artifactId>
			<version>1.1.13</version>
		</dependency>
		
		<!-- 分页插件 -->
		<dependency>
			<groupId>com.github.pagehelper</groupId>
			<artifactId>pagehelper-spring-boot-starter</artifactId>
			<version>1.2.5</version>
		</dependency>
		
	
		<!-- Swagger -->
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger2</artifactId>
			<version>2.6.1</version>
		</dependency>
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger-ui</artifactId>
			<version>2.6.1</version>
		</dependency>
		
		<!-- json -->
		<dependency>
			<groupId>org.codehaus.jettison</groupId>
			<artifactId>jettison</artifactId>
			<version>1.4.0</version>
		</dependency>
		
		<!-- shiro -->
		<dependency>
	        <groupId>org.apache.shiro</groupId>
	        <artifactId>shiro-spring</artifactId>
	        <version>1.4.0</version>
        </dependency>
		
		<!-- redis -->
		<dependency>
		     <groupId>org.springframework.boot</groupId>
		     <artifactId>spring-boot-starter-data-redis</artifactId>
		     <exclusions>
		         <exclusion>
		             <groupId>io.lettuce</groupId>
		             <artifactId>lettuce-core</artifactId>
		         </exclusion>
		     </exclusions>
		</dependency>
		
		<!-- jedis -->
		<dependency>
		     <groupId>redis.clients</groupId>
		     <artifactId>jedis</artifactId>
		</dependency>
		
		<!-- 汉字转拼音码 -->
		<dependency>
			<groupId>com.belerweb</groupId>
			<artifactId>pinyin4j</artifactId>
			<version>2.5.0</version>
		</dependency>
		
		<!-- 热部署 -->
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-devtools</artifactId>
			<optional>true</optional>
		</dependency>
    </dependencies>
	
	
	<build>
  		<plugins>
  			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
				<configuration>
					<!--fork : 如果没有该项配置,这个devtools不会起作用,即应用不会restart -->
					<fork>true</fork>
					<!--支持静态文件热部署 -->
					<addResources>true</addResources>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.tomcat.maven</groupId>
				<artifactId>tomcat7-maven-plugin</artifactId>
				<configuration>
					<port>8080</port>
					
					<url>http://192.168.0.163:8080/manager/text</url>
					<username>tomcat</username>
					<password>tomcat</password>
					<!-- 应用的部署位置,EN就表示发布到tomcat服务器上的项目名称 -->
					<path>/EN</path>  
					<update>true</update>
				</configuration>
			</plugin>
		</plugins>
  </build>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值