Compare commits
3 Commits
Branch/yzp
...
main
| Author | SHA1 | Date |
|---|---|---|
|
|
2e00491bfc | 1 year ago |
|
|
739282e227 | 1 year ago |
|
|
d89db12e9b | 1 year ago |
@ -0,0 +1,10 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
# Zeppelin 忽略的文件
|
||||
/ZeppelinRemoteNotebooks/
|
||||
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="springcache-demo" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="springcache-demo" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
@ -0,0 +1,53 @@
|
||||
package com.itheima.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class WebMvcConfiguration extends WebMvcConfigurationSupport {
|
||||
|
||||
/**
|
||||
* 生成接口文档配置
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket docket(){
|
||||
log.info("准备生成接口文档...");
|
||||
|
||||
ApiInfo apiInfo = new ApiInfoBuilder()
|
||||
.title("接口文档")
|
||||
.version("2.0")
|
||||
.description("接口文档")
|
||||
.build();
|
||||
|
||||
Docket docket = new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo)
|
||||
.select()
|
||||
//指定生成接口需要扫描的包
|
||||
.apis(RequestHandlerSelectors.basePackage("com.itheima.controller"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
|
||||
return docket;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置静态资源映射
|
||||
* @param registry
|
||||
*/
|
||||
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
log.info("开始设置静态资源映射...");
|
||||
registry.addResourceHandler("/doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.itheima.mapper;
|
||||
|
||||
import com.itheima.entity.User;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper{
|
||||
|
||||
@Insert("insert into user(name,age) values (#{name},#{age})")
|
||||
@Options(useGeneratedKeys = true,keyProperty = "id")
|
||||
void insert(User user);
|
||||
|
||||
@Delete("delete from user where id = #{id}")
|
||||
void deleteById(Long id);
|
||||
|
||||
@Delete("delete from user")
|
||||
void deleteAll();
|
||||
|
||||
@Select("select * from user where id = #{id}")
|
||||
User getById(Long id);
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
# 定义服务的配置项
|
||||
server:
|
||||
# 设置服务的端口号为8888
|
||||
port: 8888
|
||||
spring:
|
||||
# 数据源配置
|
||||
datasource:
|
||||
# 配置Druid连接池
|
||||
druid:
|
||||
# 指定JDBC驱动类名
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 指定数据库连接URL
|
||||
url: jdbc:mysql://localhost:3306/spring_cache_demo?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
# 指定数据库用户名
|
||||
username: root
|
||||
# 指定数据库密码
|
||||
password: root
|
||||
# Redis配置
|
||||
redis:
|
||||
# 指定Redis服务器地址
|
||||
host: localhost
|
||||
# 指定Redis服务器端口
|
||||
port: 6379
|
||||
# 指定Redis密码
|
||||
password: 123456
|
||||
# 指定Redis数据库索引
|
||||
database: 1
|
||||
# 日志配置
|
||||
logging:
|
||||
# 设置日志级别
|
||||
level:
|
||||
# 设置com.itheima包下的mapper日志级别为debug
|
||||
com:
|
||||
itheima:
|
||||
mapper: debug
|
||||
# 设置com.itheima包下的service日志级别为info
|
||||
service: info
|
||||
# 设置com.itheima包下的controller日志级别为info
|
||||
controller: info
|
||||
@ -0,0 +1,21 @@
|
||||
server:
|
||||
port: 8888
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/spring_cache_demo?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: root
|
||||
redis:
|
||||
host: localhost
|
||||
port: 6379
|
||||
password: 123456
|
||||
database: 1
|
||||
logging:
|
||||
level:
|
||||
com:
|
||||
itheima:
|
||||
mapper: debug
|
||||
service: info
|
||||
controller: info
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue