配置并不是我的原创,我是根据https://gitee.com/geek_qi/ace-security/tree/master工程做的笔记
1 maven配置
1.1 lombok
有时为了偷懒,使用了lombok,以前并不推荐,现在写springboot工程,发现很多人比较热衷。
比如Spring Boot下的lombok安装以及使用简介
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
1.2 spring-boot-maven-plugin
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
并不是所有的jar都需要这个插件,或许你只是想做一个组件。如果没有main函数,他就会提示下面的异常,
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:repackage (default) on project bwjf-gateway-zuul: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:2.0.0.RELEASE:repackage failed: Unable to find main class -> [Help 1]
2 zuul
可以参考一下使用Zuul构建API Gateway中相关说明
3 文件配置
application.yml
和bootstrap.yml
这两个配置文件的作用是不同的,详细可参见Spring Boot中application.yml与bootstrap.yml的区别(转)
因为要总结其他的,这里待续中。。。