Okta Spring Boot 2 Angular 5 示例项目教程
1. 项目目录结构及介绍
okta-spring-boot-2-angular-5-example/
├── client/
│ ├── src/
│ ├── angular.json
│ ├── package.json
│ ├── tsconfig.json
│ └── ...
├── server/
│ ├── src/
│ ├── pom.xml
│ ├── application.properties
│ └── ...
├── .gitignore
├── LICENSE
├── README.md
└── ...
目录结构说明
-
client/: 包含Angular前端项目的所有文件。
- src/: Angular项目的源代码。
- angular.json: Angular项目的配置文件。
- package.json: 定义了前端项目的依赖和脚本。
- tsconfig.json: TypeScript配置文件。
-
server/: 包含Spring Boot后端项目的所有文件。
- src/: Spring Boot项目的源代码。
- pom.xml: Maven项目的配置文件,定义了后端项目的依赖。
- application.properties: Spring Boot项目的配置文件。
-
.gitignore: Git忽略文件列表。
-
LICENSE: 项目许可证。
-
README.md: 项目说明文档。
2. 项目启动文件介绍
前端启动文件
- client/package.json
scripts
部分定义了启动命令:"scripts": { "start": "ng serve", ... }
- 启动前端项目:
cd client npm install npm start
后端启动文件
-
server/pom.xml
- 定义了Spring Boot项目的依赖和构建配置。
-
server/src/main/java/com/okta/developer/demo/DemoApplication.java
- Spring Boot应用的主类,包含
main
方法:@SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
- 启动后端项目:
cd server ./mvnw spring-boot:run
- Spring Boot应用的主类,包含
3. 项目的配置文件介绍
前端配置文件
-
client/angular.json
- Angular项目的配置文件,包含项目结构、构建选项等。
-
client/tsconfig.json
- TypeScript配置文件,定义了编译选项。
后端配置文件
-
server/application.properties
- Spring Boot项目的配置文件,包含数据库连接、服务器端口等配置:
server.port=8080 spring.datasource.url=jdbc:mysql://localhost:3306/demo spring.datasource.username=root spring.datasource.password=password
- Spring Boot项目的配置文件,包含数据库连接、服务器端口等配置:
-
server/pom.xml
- Maven配置文件,定义了项目的依赖和构建配置。
通过以上步骤,您可以成功启动并配置okta-spring-boot-2-angular-5-example
项目。希望本教程对您有所帮助!