注意
Maven
Maven 项目打包源文件 *-sources.jar
可以解决本地打包无法下载源码问题
Cannot download sources Sources not found for: com.v0710:do-common:1.0.0
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Springboot
1,多模块项目
在Springboot 多模块项目中,不要在父pom文件和其他没有启动类的项目中配置 build 标签。只在需要的子项目的pom文件中配置(一般是web项目)
2,mapper.xml文件
1,mapper.xml放在非resources
下
1-1,设置pom.xml
<!-- 过滤xml文件-->
<resources>
<resource>
<!-- java目录 -->
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<!-- resources -->
<directory>src/main/resources</directory>
<includes>
<include>**.*</include>
<include>**/*.*</include><!-- i18n能读取到 -->
<include>**/*/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugin>
<executions>
<execution>
<goals>
<goal>repackage</goal><!--可以把依赖的包都打包到生成的Jar包中-->
</goals>
</execution>
</executions>
</plugin>
1-2,配置配置文件配置mapper映射路径
mybatis-plus.mapper-locations=com/yifan/mapper/xml/*.xml
2,mapper.xml 放在resources
目录下
2-1,设置mapper映射路径
mybatis-plus.mapper-locations=classpath:xml/*.xml
You ran ‘git add’ with neither ‘-A (–all)’ or ‘–ignore-removal’,
whose behaviour will change in Git 2.0 with respect to paths you removed.
Paths like ‘Gitbook.md’ that are
git fetch –all
git reset –hard origin/master
git pull
git config --global user.name "MEliauk"
git config --global user.email "2050781802@qq.com"
git config --global core.autocrlf input
ssh -T git@gitee.com
#拉取最新代码部署
cd /apps/gitbook/
CURRENT=pwd
echo “$CURRENT”
git fetch –all
git reset –hard origin/master
git pull
echo “拉取代码完成。。。。。”
git remote add origin https://gitee.com/MEliauk/note.git
3,springboot项目配置https
SpringBoot自带的是tomcat服务器一般使用的.jks文件配置SSL加密。
配置文件
server.ssl.key-store=classpath:v0710.top.jks
server.ssl.key-store-password=77bo2c1fe56ca3
server.ssl.key-store-type=JKS
在resource目录下放入jks文件
同时配置http和https都能访问
新整配置
#http端口号
http.port=18092
在启动了中添加
// 获取配置端口
@Value("${http.port}")
private Integer httpPort;
@Bean
public ServletWebServerFactory servletContainer() {
TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
// 添加http
tomcat.addAdditionalTomcatConnectors(createStandardConnector());
return tomcat;
}
// 配置http
private Connector createStandardConnector() {
Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
connector.setPort(httpPort);
return connector;
}
4,SpringBoot项目http访问上传文件接口正常但切到https访问上传文件接口失败
springboot内置的Tomcat存在bug,进行升级即可。(注:之前是9.0.31,升级到了9.0.41,问题得到了解决)
springboot项目在调文件上传接口上传文件时使用http访问请求可以上传成功,但是切换到https
请求时就会报错,报错提示:Processing of multipart/form-data request failed. Stream ended unexpectedly。
报错信息
Failed to parse multipart servlet request; nested exception is java.io.IOException: org.apache.tomcat.util.http.fileupload.impl.IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
解决
<properties>
<tomcat.version>9.0.41</tomcat.version>
</properties>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>${tomcat.version}</version>
</dependency>
Hutool
1,JSON 转换注意
JSONUtil.toJsonStr(list, JSONConfig.create().setIgnoreNullValue(false))
IgnoreNullValue // 是否忽略null值
日夜颠倒头发少 ,单纯好骗恋爱脑 ,会背九九乘法表 ,下雨只会往家跑 ,搭讪只会说你好 ---- 2050781802@qq.com