• 觉哥java网站搭建笔记——后端开发环境搭建


    一.后端环境搭建(jdk17+springboot3.0)

    1.1maven 配置文件修改

    设置编译jdk的版本:

    1. <profiles>
    2. <profile>
    3. <id>jdk-17id>
    4. <activation>
    5. <activeByDefault>trueactiveByDefault>
    6. <jdk>17jdk>
    7. activation>
    8. <properties>
    9. <maven.compiler.source>17maven.compiler.source>
    10. <maven.compiler.target>17maven.compiler.target>
    11. <maven.compiler.compilerVersion>17maven.compiler.compilerVersion>
    12. properties>
    13. profile>
    14. profiles>

    设置镜像仓库地址:

    1. <mirror>
    2. <id>
    3. alimaven
    4. id>
    5. <mirrorOf>
    6. central
    7. mirrorOf>
    8. <name>
    9. aliyun maven
    10. name>
    11. <url>
    12. https://maven.aliyun.com/repository/central
    13. url>
    14. mirror>

    1.2创建父工程及子模块+依赖版本设置

    jdk版本选择选择本地的jdk17 然后后面的java选项选17 如果17没出来要再点下 (idea bug或者是网的问题)

     

    目前初步创建 父工程 名:juegejava

    子模块名 :jjorder  jjproduct  jjuser

    父工程 pom 

    1. "1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    4. <modelVersion>4.0.0modelVersion>
    5. <parent>
    6. <groupId>org.springframework.bootgroupId>
    7. <artifactId>spring-boot-starter-parentartifactId>
    8. <version>3.0.0-SNAPSHOTversion>
    9. <relativePath/>
    10. parent>
    11. <groupId>com.juege.javagroupId>
    12. <artifactId>juejue-userartifactId>
    13. <version>0.0.1-SNAPSHOTversion>
    14. <name>juegejavaname>
    15. <description>聚合服务description>
    16. <packaging>pompackaging>
    17. <modules>
    18. <module>jjusermodule>
    19. <module>jjproductmodule>
    20. <module>jjordermodule>
    21. modules>
    22. project>

    子模块pom,不断更新中,springboot 3.0正式发布版还没出来 现在用的snapshot版本,springcloud

    中的组件都是用的最新版本 (注释了某些组件的依赖 后面用到时再引入)

    1. "1.0" encoding="UTF-8"?>
    2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    4. <modelVersion>4.0.0modelVersion>
    5. <parent>
    6. <groupId>org.springframework.bootgroupId>
    7. <artifactId>spring-boot-starter-parentartifactId>
    8. <version>3.0.0-SNAPSHOTversion>
    9. <relativePath/>
    10. parent>
    11. <groupId>com.juege.javagroupId>
    12. <artifactId>juejue-orderartifactId>
    13. <version>0.0.1-SNAPSHOTversion>
    14. <name>jjordername>
    15. <description>juegejavadescription>
    16. <properties>
    17. <java.version>17java.version>
    18. <spring-cloud.version>2022.0.0-RC1spring-cloud.version>
    19. <cloud-component.version>3.1.4cloud-component.version>
    20. properties>
    21. <dependencies>
    22. <dependency>
    23. <groupId>org.springframework.bootgroupId>
    24. <artifactId>spring-boot-starter-amqpartifactId>
    25. dependency>
    26. <dependency>
    27. <groupId>org.springframework.bootgroupId>
    28. <artifactId>spring-boot-starter-quartzartifactId>
    29. dependency>
    30. <dependency>
    31. <groupId>mysqlgroupId>
    32. <artifactId>mysql-connector-javaartifactId>
    33. dependency>
    34. <dependency>
    35. <groupId>org.springframework.bootgroupId>
    36. <artifactId>spring-boot-starter-securityartifactId>
    37. dependency>
    38. <dependency>
    39. <groupId>org.apache.kafkagroupId>
    40. <artifactId>kafka-streamsartifactId>
    41. dependency>
    42. <dependency>
    43. <groupId>org.springframework.cloudgroupId>
    44. <artifactId>spring-cloud-starter-openfeignartifactId>
    45. <version>${cloud-component.version}version>
    46. dependency>
    47. <dependency>
    48. <groupId>org.springframework.kafkagroupId>
    49. <artifactId>spring-kafkaartifactId>
    50. dependency>
    51. <dependency>
    52. <groupId>org.springframework.bootgroupId>
    53. <artifactId>spring-boot-devtoolsartifactId>
    54. <scope>runtimescope>
    55. <optional>trueoptional>
    56. dependency>
    57. <dependency>
    58. <groupId>org.springframework.bootgroupId>
    59. <artifactId>spring-boot-configuration-processorartifactId>
    60. <optional>trueoptional>
    61. dependency>
    62. <dependency>
    63. <groupId>org.projectlombokgroupId>
    64. <artifactId>lombokartifactId>
    65. <optional>trueoptional>
    66. dependency>
    67. <dependency>
    68. <groupId>org.springframework.bootgroupId>
    69. <artifactId>spring-boot-starter-testartifactId>
    70. <scope>testscope>
    71. dependency>
    72. <dependency>
    73. <groupId>org.springframework.kafkagroupId>
    74. <artifactId>spring-kafka-testartifactId>
    75. <scope>testscope>
    76. dependency>
    77. <dependency>
    78. <groupId>org.springframework.securitygroupId>
    79. <artifactId>spring-security-testartifactId>
    80. <scope>testscope>
    81. dependency>
    82. dependencies>
    83. <dependencyManagement>
    84. <dependencies>
    85. <dependency>
    86. <groupId>org.springframework.cloudgroupId>
    87. <artifactId>spring-cloud-dependenciesartifactId>
    88. <version>${spring-cloud.version}version>
    89. <type>pomtype>
    90. <scope>importscope>
    91. dependency>
    92. dependencies>
    93. dependencyManagement>
    94. <repositories>
    95. <repository>
    96. <id>spring-milestonesid>
    97. <name>Spring Milestonesname>
    98. <url>https://repo.spring.io/milestoneurl>
    99. <snapshots>
    100. <enabled>falseenabled>
    101. snapshots>
    102. repository>
    103. <repository>
    104. <id>spring-snapshotsid>
    105. <name>Spring Snapshotsname>
    106. <url>https://repo.spring.io/snapshoturl>
    107. <releases>
    108. <enabled>falseenabled>
    109. releases>
    110. repository>
    111. <repository>
    112. <id>netflix-candidatesid>
    113. <name>Netflix Candidatesname>
    114. <url>https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidatesurl>
    115. <snapshots>
    116. <enabled>falseenabled>
    117. snapshots>
    118. repository>
    119. repositories>
    120. <pluginRepositories>
    121. <pluginRepository>
    122. <id>spring-milestonesid>
    123. <name>Spring Milestonesname>
    124. <url>https://repo.spring.io/milestoneurl>
    125. <snapshots>
    126. <enabled>falseenabled>
    127. snapshots>
    128. pluginRepository>
    129. <pluginRepository>
    130. <id>spring-snapshotsid>
    131. <name>Spring Snapshotsname>
    132. <url>https://repo.spring.io/snapshoturl>
    133. <releases>
    134. <enabled>falseenabled>
    135. releases>
    136. pluginRepository>
    137. pluginRepositories>
    138. project>

    1.3腾讯云server配置

    防火墙  -》端口开放

     密钥,一般默认就有

    1.4安装docker 并配置加速

    安装 docker

    配置加速

    1.5 拉取常用软件镜像 及创建并运行容器

    安装mysql

    安装redis

    配置自动重启

    1. docker update mysql --restart=always
    2. docker update redis --restart=always

    1.6版本控制gitee配置

    版本控制的准备(码云+git+配置SSH免密连接)

    1.7建库建表需在server上进入 mysql bash控制台操作

    1. [root@localhost ~]# docker exec -it mysqlaa bash
    2. root@31e36f35d688:/# mysql -uroot -p
    3. 输入密码root

  • 相关阅读:
    Python数据分析训练营——Python数据分析之Numpy
    Quartz定时任务基础学习
    独立接软件外包遇到的问题总结,希望能帮到你
    Qt扫盲-QSqlField 理论总结
    java动态代理-jdk动态代理原理解析
    Java面试题-Redis-第四天(线程模型一)
    【大数据】Apache NiFi 数据同步流程实践
    win环境安装SuperMap iserver和配置许可
    为什么在token在http请求头中的Authorization要加Bearer前缀?
    软件系统建模&架构风格-架构论文(三十八)
  • 原文地址:https://blog.csdn.net/JavaCoder_juejue/article/details/127834078