快速开始
像数1,2,3一样容易
- 在项目 pom.xml 中锁定版本(以下两种方式任选其一)
方式一:如您使用的是 Spring Boot Parent 的方式,则替换 Spring Boot Parent 为 ContiNew Starter。
xml
<parent>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter</artifactId>
<version>{latest-version}</version>
</parent>
方式二:如您使用的是引入 Spring Boot Dependencies 的方式,则替换 Spring Boot Dependencies 为 ContiNew Starter Dependencies
xml
<properties>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- ContiNew Starter Dependencies -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-dependencies</artifactId>
<version>{latest-version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
- 在项目 pom.xml 中引入所需模块依赖
xml
<dependencies>
<!-- Web 模块 -->
<dependency>
<groupId>top.continew.starter</groupId>
<artifactId>continew-starter-web</artifactId>
</dependency>
</dependencies>
- 在 application.yml 中根据引入模块,添加所需配置
示例:跨域配置
yaml
# 跨域配置
continew-starter.web:
cors:
enabled: true
# 配置允许跨域的域名
allowed-origins: '*'
# 配置允许跨域的请求方式
allowed-methods: '*'
# 配置允许跨域的请求头
allowed-headers: '*'
# 配置允许跨域的响应头
exposed-headers: '*'