原料

新鲜的IntelliJ IDEA、一双手、以及电脑一台。

搭建框架

新建项目

打开IDE,点击File -> New Project。在左侧的列表中的选择Maven项目,点击Next。

填写GroupId和ArtifactId

什么是GroupId和ArtifactId?大家可以参考一下google出来的定义,可以参考一下。

GroupID是项目组织唯一的标识符,实际对应JAVA的包的结构,是main目录里java的目录结构。

ArtifactID就是项目的唯一的标识符,实际对应项目的名称,就是项目根目录的名称

简单理解一下,可以理解为GroupId就是你的Github账号,而ArtifactId就是你的具体某个项目,例如这个例子的源码,SpringBootDemo,detectiveHLH/springbootdemo
detectiveHLH就是GroupId,而ArtifactId就是后面的项目名称。

所以,这里应该填写如下(仅供参考)。

  1. GroupId: com.detectivehlh.test
  2. ArtifactId: parent

test为项目的名称。ArtifactId代表父类,所以就写parent了。点击Next。

设置Project Name和Project Location

ProjectName就写项目的名称就好。Project Location就是项目在你本地的真实路径。填好之后,点击Next。

然后可以看到IDE已经新建好了项目。

  1. .
  2. ├── pom.xml
  3. ├── src
  4.    ├── main
  5.       ├── java
  6.       └── resources
  7.    └── test
  8.    └── java
  9. └── test.iml

然后右下角会弹出Maven projects need to be imported,选择右边的Enable Auto-Imported.然后删除src目录。

新建模块

本次项目的框架一共有四层结构,也可以说是有四个模块。分别是api、core、data、domain.我们从底层开始,自底向上开始构建模块。

domain

存放实体类

点击File -> New -> Module,在左侧的列表中选择Maven,点击Next。在ArtifactId处填 domain,一路Next。

data模块

主要是做一些对数据库的操作

点击File -> New -> Module,在左侧的列表中选择Maven,点击Next。在ArtifactId处填 data,一路Next。在模块中其实是存在相互依赖关系的。
data模块依赖domain模块的实体。所以要在data文件的配置文件中实现对domain的依赖。

打开data目录中的pom.xml文件。在

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.detectivehlh.test</groupId>
  4. <artifactId>domain</artifactId>
  5. <version>1.0-SNAPSHOT</version>
  6. </dependency>
  7. </dependencies>

core模块

后端主要的业务逻辑都会在core模块中。

点击File -> New -> Module,在左侧的列表中选择Maven,点击Next。在ArtifactId处填 core,一路Next。同上,此处也需要配置依赖关系。
core模块的中的service会依赖data模块中的数据。

打开core目录下的pom.xml文件。在

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.detectivehlh.test</groupId>
  4. <artifactId>data</artifactId>
  5. <version>1.0-SNAPSHOT</version>
  6. </dependency>
  7. </dependencies>

api模块

主要是存放供前端调用的接口。

点击File -> New -> Module,在左侧的列表中选择Maven,点击Next。在ArtifactId处填 api,一路Next。此处的api模块依赖core中的service服务。

打开api目录下的pom.xml文件。在

  1. <dependencies>
  2. <dependency>
  3. <groupId>com.detectivehlh.test</groupId>
  4. <artifactId>core</artifactId>
  5. <version>1.0-SNAPSHOT</version>
  6. </dependency>
  7. </dependencies>

让项目"走两步"

到此,框架算是搭建好了,下一步就是要让项目"走两步"来看看。此时的项目的目录如下。

  1. .
  2. ├── api
  3.    ├── api.iml
  4.    ├── pom.xml
  5.    └── src
  6.    ├── main
  7.       ├── java
  8.       └── resources
  9.    └── test
  10.    └── java
  11. ├── core
  12.    ├── pom.xml
  13.    └── src
  14.    ├── main
  15.       ├── java
  16.       └── resources
  17.    └── test
  18.    └── java
  19. ├── data
  20.    ├── pom.xml
  21.    └── src
  22.    ├── main
  23.       ├── java
  24.       └── resources
  25.    └── test
  26.    └── java
  27. ├── domain
  28.    ├── pom.xml
  29.    └── src
  30.    ├── main
  31.       ├── java
  32.       └── resources
  33.    └── test
  34.    └── java
  35. ├── pom.xml
  36. └── test.iml

定位到/api/src/main/java,在java目录下新建package,名字为你之前定义的groupid再加上模块名,举个例子。我这的名字就应该为com.detectivehlh.test.api,然后
在该包下新建名为Application的class。然后将代码替换成如下代码。

  1. package com.detectivehlh.test.api;
  2. import org.springframework.boot.SpringApplication;
  3. import org.springframework.boot.autoconfigure.SpringBootApplication;
  4. @SpringBootApplication
  5. public class Application {
  6. public static void main(String[] args) {
  7. SpringApplication.run(Application.class, args);
  8. }
  9. }

此时会报错,是因为springboot的各项依赖,都还没有引入项目的dependences。打开根目录下的pom.xml文件,添加如下依赖。

  1. <parent>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-parent</artifactId>
  4. <version>2.0.4.RELEASE</version>
  5. <relativePath/> <!-- lookup parent from repository -->
  6. </parent>

然后打开api目录下的pom.xml文件。在dependencies标签中添加如下依赖。

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot</artifactId>
  4. </dependency>
  5. <dependency>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-autoconfigure</artifactId>
  8. </dependency>
  9. <dependency>
  10. <groupId>org.springframework.boot</groupId>
  11. <artifactId>spring-boot-starter-web</artifactId>
  12. </dependency>

此时Application中就不会报错了。然后就可以启动项目了。打开Application这个类,在SpringBootApplication注解下有个绿色的启动键,点击即可启动项目。之后可在右上方启动。

启动之后,打开http://localhost:8080,如果页面显示

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.

Tue Sep 18 19:01:11 CST 2018
There was an unexpected error (type=Not Found, status=404).
No message available

那么一个简单的springboot应用就可以启动成功了。

实现controller层

com.detectivehlh.test.api包下,新建一个名为controller的包。然后新建名为HelloController的class。
将其全部替换为如下代码(包名根据你的项目命名自行修改)。

  1. package com.detectivehlh.test.api.controller;
  2. import org.springframework.web.bind.annotation.GetMapping;
  3. import org.springframework.web.bind.annotation.RestController;
  4. @RestController
  5. public class HelloController {
  6. @GetMapping("/hello")
  7. public String hello() {
  8. return "Hello, SpringBoot";
  9. }
  10. }

重新启动项目,访问http://localhost:8080/hello,就可以看到页面显示如下信息。

Hello, SpringBoot

@RestController注解比较适用于Restful风格的API,如果接口只关心数据,不做server render,就可以使用@RestController注解。
如果接口需要返回模版页面,则需要使用@Controller注解。

@GetMapping注解,是将HTTP Get请求映射到我们自定义的hello方法上。

实现service层

新建CoreConfiguration

定位到/core/src/main/java,在java目录下新建名为com.detectivehlh.test.core的包。然后在该包新建名为CoreConfiguration的Class。
将其全部替换为如下代码(包名根据你的项目命名自行修改)。

  1. package com.detectivehlh.test.core;
  2. import org.springframework.context.annotation.ComponentScan;
  3. import org.springframework.context.annotation.Configuration;
  4. /**
  5. * @author detectiveHLH
  6. * @date 2018/09/13
  7. */
  8. @ComponentScan
  9. @Configuration
  10. public class CoreConfiguration {
  11. }

引入依赖

此时会报错,同样是因为依赖没有引入。在core的pom.xml文件中的dependencies标签中添加如下依赖。

  1. <dependency>
  2. <groupId>org.springframework</groupId>
  3. <artifactId>spring-context</artifactId>
  4. <version>5.0.5.RELEASE</version>
  5. </dependency>

稍等片刻,就不会有报错提示了。

新建Interface

在com.detectivehlh.test.core包下新建一个名为service的包。在service包下新建一个Class,
名字为HelloService,类型选择Interface。然后修改代码如下(包名根据你的项目命名自行修改)。

  1. package com.detectivehlh.test.core.service;
  2. public interface HelloService {
  3. String sayHello();
  4. }

新建实现类

在service目录下新建名为impl的包。然后在impl下新建名为HelloServiceImpl的类。修改代码如下(包名根据你的项目命名自行修改)。

  1. package com.detectivehlh.test.core.service.impl;
  2. import com.detectivehlh.test.core.service.HelloService;
  3. import org.springframework.stereotype.Service;
  4. @Service
  5. public class HelloServiceImpl implements HelloService {
  6. @Override
  7. public String sayHello() {
  8. return "Hello, SpringBoot";
  9. }
  10. }

调用实现类

修改HelloController中的 hello 方法的代码如下(包名根据你的项目命名自行修改)。

  1. package com.detectivehlh.test.api.controller;
  2. import com.detectivehlh.test.core.service.HelloService;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.GetMapping;
  5. import org.springframework.web.bind.annotation.RestController;
  6. /**
  7. * RestController
  8. * 定义为Restful风格的API控制器
  9. */
  10. @RestController
  11. public class HelloController {
  12. @Autowired
  13. private HelloService helloService;
  14. @GetMapping("/hello")
  15. public String hello() {
  16. return helloService.sayHello();
  17. }
  18. }

此时helloService会报错,这是因为我们没有将HelloService这个添加到Bean容器中来。修改Application类代码如下(包名根据你的项目命名自行修改)。

  1. package com.detectivehlh.test.api;
  2. import com.detectivehlh.test.core.CoreConfiguration;
  3. import org.springframework.boot.SpringApplication;
  4. import org.springframework.boot.autoconfigure.SpringBootApplication;
  5. import org.springframework.context.annotation.Import;
  6. @SpringBootApplication
  7. @Import(CoreConfiguration.class)
  8. public class Application {
  9. public static void main(String[] args) {
  10. SpringApplication.run(Application.class, args);
  11. }
  12. }

此时再访问http://localhost:8080/hello,就可以看到如下正常的输出了。

Hello, SpringBoot

打通数据库

实现了简单的service,下一步就是要连接数据库。假设现在在你本地已经有了mysql服务。有名为test的数据库,该数据库下有名为user_role的表。表结构如下。

数据库表名和表数据

column_name column_value
id 用户id
name 用户名

并且有了数据

column_name column_value
id name
1 detectiveHLH

新建实体类

定位到/domain/src/main/java,在java目录下新建名为com.detectivehlh.test.domain的包。在该包下新建entity包。
在entity下新建名为BaseEntity的抽象类。修改代码如下。

  1. package com.detectivehlh.test.domain.entity;
  2. public abstract class BaseEntity {
  3. private long createdAt;
  4. private String createdBy;
  5. private long updatedAt;
  6. private String updatedBy;
  7. public long getCreatedAt() {
  8. return createdAt;
  9. }
  10. public void setCreatedAt(long createdAt) {
  11. this.createdAt = createdAt;
  12. }
  13. public String getCreatedBy() {
  14. return createdBy;
  15. }
  16. public void setCreatedBy(String createdBy) {
  17. this.createdBy = createdBy;
  18. }
  19. public long getUpdatedAt() {
  20. return updatedAt;
  21. }
  22. public void setUpdatedAt(long updatedAt) {
  23. this.updatedAt = updatedAt;
  24. }
  25. public String getUpdatedBy() {
  26. return updatedBy;
  27. }
  28. public void setUpdatedBy(String updatedBy) {
  29. this.updatedBy = updatedBy;
  30. }
  31. }

在entity下新建名为UserRole的类。代码如下。

  1. package com.detectivehlh.test.domain.entity;
  2. public class UserRole extends BaseEntity {
  3. private int id;
  4. private String name;
  5. public int getId() {
  6. return id;
  7. }
  8. public void setId(int id) {
  9. this.id = id;
  10. }
  11. public String getName() {
  12. return name;
  13. }
  14. public void setName(String name) {
  15. this.name = name;
  16. }
  17. }

新建dao层

实现与数据库交互的mapper。

定位到/data/src/main/java,在java目录下新建名为com.detectivehlh.test.data的包。在该包下新建名为dao的包和名为
DataConfiguration的类。然后在dao包下新建名为UserRoleMapper的类。DataConfiguration代码如下。

  1. package com.detectivehlh.test.data;
  2. import org.mybatis.spring.annotation.MapperScan;
  3. import org.springframework.context.annotation.ComponentScan;
  4. import org.springframework.context.annotation.Configuration;
  5. /**
  6. * @author duzhengkang
  7. * @date 2018/6/25
  8. */
  9. @ComponentScan
  10. @Configuration
  11. @MapperScan("com.detectivehlh.test.data.dao")
  12. public class DataConfiguration {
  13. }

将UserRoleMapper的代码修改为如下。

  1. package com.detectivehlh.test.data.dao;
  2. import com.detectivehlh.test.domain.entity.UserRole;
  3. import org.apache.ibatis.annotations.Mapper;
  4. import org.apache.ibatis.annotations.Param;
  5. import org.springframework.stereotype.Repository;
  6. import java.util.List;
  7. @Mapper
  8. @Repository
  9. public interface UserRoleMapper {
  10. /**
  11. * 查询所有的用户角色
  12. * @return
  13. */
  14. List<UserRole> all();
  15. }

此时代码会报错,同样的依赖原因。打开根目录下的pom.xml文件。添加如下依赖。

  1. <dependency>
  2. <groupId>com.alibaba</groupId>
  3. <artifactId>druid</artifactId>
  4. <version>1.1.10</version>
  5. </dependency>
  6. <dependency>
  7. <groupId>com.github.pagehelper</groupId>
  8. <artifactId>pagehelper-spring-boot-starter</artifactId>
  9. <version>1.2.5</version>
  10. </dependency>
  11. <dependency>
  12. <groupId>mysql</groupId>
  13. <artifactId>mysql-connector-java</artifactId>
  14. <version>6.0.6</version>
  15. </dependency>
  16. <dependency>
  17. <groupId>org.mybatis.spring.boot</groupId>
  18. <artifactId>mybatis-spring-boot-starter</artifactId>
  19. <version>1.3.2</version>
  20. </dependency>

添加如上依赖,稍等片刻,就不会报错了。但是此时运行项目依旧会报错。是因为我们引入了mybatis但是却没有配置文件。以及没有将mapper注入到容器中去。

修改Application中的代码如下。

  1. package com.detectivehlh.test.api;
  2. import com.detectivehlh.test.core.CoreConfiguration;
  3. import com.detectivehlh.test.data.DataConfiguration;
  4. import org.springframework.boot.SpringApplication;
  5. import org.springframework.boot.autoconfigure.SpringBootApplication;
  6. import org.springframework.context.annotation.Import;
  7. @SpringBootApplication
  8. @Import({CoreConfiguration.class, DataConfiguration.class})
  9. public class Application {
  10. public static void main(String[] args) {
  11. SpringApplication.run(Application.class, args);
  12. }
  13. }

mapper就被注入到容器中去了。下一步需要添加配置文件。定位到/api/src/main/resources,新建application.yaml文件。
修改代码如下。

  1. spring:
  2. application:
  3. name: test
  4. # 数据库配置
  5. datasource:
  6. driver-class-name: com.mysql.cj.jdbc.Driver
  7. username: root
  8. password: 9687Luohongwei
  9. url: jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true
  10. # mapper文件配置
  11. mybatis:
  12. mapper-locations: classpath:mapper/*.xml
  13. configuration:
  14. log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

修改完毕后,启动项目,访问http://localhost:8080/hello,就可以看到正常输出了。

实现mapper

定位到/data/src/main/resources,新建名为mapper的包。在mapper包下新建名为UserRoleMapper的xml文件。修改代码如下。

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.detectivehlh.test.data.dao.UserRoleMapper">
  5. <!--用于与数据库字段作一一对应-->
  6. <resultMap id="userRoleMap" type="com.detectivehlh.test.domain.entity.UserRole">
  7. <result column="id" property="id"/>
  8. <result column="name" property="name"/>
  9. </resultMap>
  10. <!--查询下方列出的所有列-->
  11. <sql id="allColumns">
  12. id, name
  13. </sql>
  14. <!--定义表名-->
  15. <sql id="tableName">
  16. user_role
  17. </sql>
  18. <select id="all" resultMap="userRoleMap">
  19. SELECT
  20. <include refid="allColumns"/>
  21. FROM
  22. <include refid="tableName"/>
  23. ORDER BY id DESC
  24. </select>
  25. </mapper>

一定注意namespace是否准确。

调用mapper

修改实现类HelloServiceImpl代码如下。

  1. package com.detectivehlh.springbootdemo.core.service.impl;
  2. import com.detectivehlh.springbootdemo.core.service.HelloService;
  3. import com.detectivehlh.springbootdemo.data.dao.UserRoleMapper;
  4. import com.detectivehlh.springbootdemo.domain.entity.UserRole;
  5. import org.springframework.beans.factory.annotation.Autowired;
  6. import org.springframework.stereotype.Service;
  7. import java.util.List;
  8. @Service
  9. public class HelloServiceImpl implements HelloService {
  10. @Autowired
  11. private UserRoleMapper userRoleMapper;
  12. @Override
  13. public List<UserRole> createToken(String key) {
  14. List<UserRole> data = userRoleMapper.all();
  15. return data;
  16. }
  17. }

此时会报错,是因为实现类中的返回类型已经变成了List

  1. package com.detectivehlh.test.core.service;
  2. import com.detectivehlh.test.domain.entity.UserRole;
  3. import java.util.List;
  4. public interface HelloService {
  5. List<UserRole> sayHello();
  6. }

让我们回到controller中,我们发现在HelloController中也有报错。这个错误同样也是因为返回类型不一致的原因,修改代码如下。

  1. package com.detectivehlh.test.api.controller;
  2. import com.detectivehlh.test.core.service.HelloService;
  3. import com.detectivehlh.test.domain.entity.UserRole;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.web.bind.annotation.GetMapping;
  6. import org.springframework.web.bind.annotation.RestController;
  7. import java.util.List;
  8. /**
  9. * RestController
  10. * 定义为Restful风格的API控制器
  11. */
  12. @RestController
  13. public class HelloController {
  14. @Autowired
  15. private HelloService helloService;
  16. @GetMapping("/hello")
  17. public List<UserRole> hello() {
  18. return helloService.sayHello();
  19. }
  20. }

然后启动项目,访问http://localhost:8080/hello。就可以看到,接口返回了user_role表中的所有数据。

  1. [
  2. {
  3. "createdAt": 0,
  4. "createdBy": null,
  5. "updatedAt": 0,
  6. "updatedBy": null,
  7. "id": 1,
  8. "name": "Tom"
  9. }
  10. ]

此时虽然能够正常访问,但是会在控制台报如下警告。

Tue Sep 18 20:40:22 CST 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

在com.detectivehlh.test.api包下新建config包,在config包中新建DbConfig文件。代码如下。

  1. package com.detectivehlh.test.api.config;
  2. import com.alibaba.druid.pool.DruidDataSource;
  3. import org.springframework.boot.context.properties.ConfigurationProperties;
  4. import org.springframework.context.annotation.Bean;
  5. import org.springframework.context.annotation.Configuration;
  6. import org.springframework.jdbc.core.JdbcTemplate;
  7. import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  8. import org.springframework.transaction.PlatformTransactionManager;
  9. import org.springframework.transaction.annotation.EnableTransactionManagement;
  10. import javax.sql.DataSource;
  11. /**
  12. * DbConfig
  13. *
  14. * @author detectiveHLH
  15. * @date 2018-07-27 10:35
  16. **/
  17. @Configuration
  18. @ConfigurationProperties
  19. @EnableTransactionManagement
  20. public class DbConfig {
  21. @Bean
  22. @ConfigurationProperties("spring.datasource")
  23. public DataSource dataSource(){
  24. DruidDataSource dataSource = new DruidDataSource();
  25. return dataSource;
  26. }
  27. @Bean
  28. public JdbcTemplate jdbcTemplate(){
  29. return new JdbcTemplate(dataSource());
  30. }
  31. @Bean
  32. public PlatformTransactionManager transactionManager(){
  33. DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager(dataSource());
  34. return dataSourceTransactionManager;
  35. }
  36. }

重启启动项目,访问接口时就不会有警告了。

最后的代码目录结构如下。

  1. .
  2. ├── api
  3.    ├── api.iml
  4.    ├── pom.xml
  5.    ├── src
  6.       ├── main
  7.          ├── java
  8.             └── com
  9.             └── detectivehlh
  10.             └── test
  11.             └── api
  12.             ├── Application.java
  13.             ├── config
  14.                └── DbConfig.java
  15.             └── controller
  16.             └── HelloController.java
  17.          └── resources
  18.          └── application.yml
  19.       └── test
  20.       └── java
  21.    └── target
  22.    ├── classes
  23.       ├── application.yml
  24.       └── com
  25.       └── detectivehlh
  26.       └── test
  27.       └── api
  28.       ├── Application.class
  29.       ├── config
  30.          └── DbConfig.class
  31.       └── controller
  32.       └── HelloController.class
  33.    └── generated-sources
  34.    └── annotations
  35. ├── core
  36.    ├── pom.xml
  37.    ├── src
  38.       ├── main
  39.          ├── java
  40.             └── com
  41.             └── detectivehlh
  42.             └── test
  43.             └── core
  44.             ├── CoreConfiguration.java
  45.             └── service
  46.             ├── HelloService.java
  47.             └── impl
  48.             └── HelloServiceImpl.java
  49.          └── resources
  50.       └── test
  51.       └── java
  52.    └── target
  53.    ├── classes
  54.       └── com
  55.       └── detectivehlh
  56.       └── test
  57.       └── core
  58.       ├── CoreConfiguration.class
  59.       └── service
  60.       ├── HelloService.class
  61.       └── impl
  62.       └── HelloServiceImpl.class
  63.    └── generated-sources
  64.    └── annotations
  65. ├── data
  66.    ├── pom.xml
  67.    ├── src
  68.       ├── main
  69.          ├── java
  70.             └── com
  71.             └── detectivehlh
  72.             └── test
  73.             └── data
  74.             ├── DataConfiguration.java
  75.             └── dao
  76.             └── UserRoleMapper.java
  77.          └── resources
  78.          └── mapper
  79.          └── UserRoleMapper.xml
  80.       └── test
  81.       └── java
  82.    └── target
  83.    ├── classes
  84.       ├── com
  85.          └── detectivehlh
  86.          └── test
  87.          └── data
  88.          ├── DataConfiguration.class
  89.          └── dao
  90.          └── UserRoleMapper.class
  91.       └── mapper
  92.       └── UserRoleMapper.xml
  93.    └── generated-sources
  94.    └── annotations
  95. ├── domain
  96.    ├── pom.xml
  97.    ├── src
  98.       ├── main
  99.          ├── java
  100.             └── com
  101.             └── detectivehlh
  102.             └── test
  103.             └── domain
  104.             └── entity
  105.             ├── BaseEntity.java
  106.             └── UserRole.java
  107.          └── resources
  108.       └── test
  109.       └── java
  110.    └── target
  111.    ├── classes
  112.       └── com
  113.       └── detectivehlh
  114.       └── test
  115.       └── domain
  116.       └── entity
  117.       ├── BaseEntity.class
  118.       └── UserRole.class
  119.    └── generated-sources
  120.    └── annotations
  121. ├── pom.xml
  122. └── test.iml

手把手教你从零开始搭建SpringBoot后端项目框架的更多相关文章

  1. Android 从零开始搭建一个主流项目框架—RxJava2.0+Retrofit2.0+OkHttp

    我这里的网络请求是用的装饰者模式去写的,什么是装饰者模式呢?在不必改变原类文件和使用继承的情况下,动态地扩展一个对象的功能.它是通过创建一个包装对象,也就是装饰来包裹真实的对象.我的理解就是一个接口, ...

  2. 手把手教你如何搭建iOS项目基本框架

    手把手教你如何搭建iOS项目基本框架 今天我们来谈谈如何搭建框架,框架需要做一些什么. 第一步:找到我们的目标我们的目标是让其他开发人员拿到手后即可写页面,不再需要考虑其他的问题. 第二步:我们需要做 ...

  3. 从零开始搭建Vue2.0项目(一)之快速开始

    从零开始搭建Vue2.0项目(一)之项目快速开始 前言 该样板适用于大型,严肃的项目,并假定您对Webpack和有所了解vue-loader.确保还阅读vue-loader的文档,了解常见的工作流程配 ...

  4. vue-用Vue-cli从零开始搭建一个Vue项目

    Vue是近两年来比较火的一个前端框架(渐进式框架吧). Vue两大核心思想:组件化和数据驱动.组件化就是将一个整体合理拆分为一个一个小块(组件),组件可重复使用:数据驱动是前端的未来发展方向,释放了对 ...

  5. 从零开始搭建一个react项目

    Nav logo 120 发现 关注 消息 4 搜索 从零开始搭建一个react项目 96 瘦人假噜噜 2017.04.23 23:29* 字数 6330 阅读 32892评论 31喜欢 36 项目地 ...

  6. Github+yeoman+gulp-angular初始化搭建angularjs前端项目框架

    在上篇文章里面我们说到了Github账号的申请与配置 那么当你有了Github账号并创建了一个自己的Github项目之后,首要的当然是搭建自己的项目框架啦! 本人对自己的定位是web前端狗,常用开发框 ...

  7. 【项目实践】SpringBoot三招组合拳,手把手教你打出优雅的后端接口

    以项目驱动学习,以实践检验真知 前言 一个后端接口大致分为四个部分组成:接口地址(url).接口请求方式(get.post等).请求数据(request).响应数据(response).如何构建这几个 ...

  8. IDEA下从零开始搭建SpringBoot工程

    SpringBoot的具体介绍可以参看其他网上介绍,这里就不多说了,就这几天的学习,个人理解,简而言之: (1)它是Spring的升级版,Spring容器能做到的事情,它都能做到,而且更简便,从配置形 ...

  9. eclipse搭建springboot的项目

    记录一次自己搭建springboot的经历 springboot项目创建 这里借用别的博主分享的方法 https://blog.csdn.net/mousede/article/details/812 ...

随机推荐

  1. pwnable.tw hacknote

    产生漏洞的原因是free后chunk未置零 unsigned int sub_80487D4() { int index; // [esp+4h] [ebp-14h] char buf; // [es ...

  2. 【转载 | 笔记】IIS无法删除应该程序池 因为它包含X个应用程序

    IIS无法删除应该程序池 因为它包含X个应用程序 今天代码主分支在vs2015创建了虚拟目录http://localhost/webapp指向的物理路径是E:\webapp 之后新开了一个分支把代码放 ...

  3. centOS7在VirtualBox中装好后的网络连接问题

    1. 环境 物理机OS:Windows 7 虚拟机:VirtualBox 虚拟机OS:CentOS7 2. 虚拟机网络设置 (该部分内容参考于网络,未深究原因,待后续研究补充) 网卡1设置如下图: 网 ...

  4. echarts-饼状图默认选中高亮

    1.首页需要设置legend legend: { data: ["积极", "负面"], selectedMode: false, show: false } ...

  5. Django与Ajax

    一.Ajax简介 AJAX(Asynchronous Javascript And XML)翻译成中文就是“异步Javascript和XML”.即使用Javascript语言与服务器进行异步交互,传输 ...

  6. https请求之绕过证书安全校验相关配置

    需在weblogic服务器上配置内存溢出的地方加入一行配置: -DUseSunHttpHandler=true      注:空格隔开 然后调用工具类:https://www.cnblogs.com/ ...

  7. MYSQL的安全模式:sql_safe_updates介绍

    什么是安全模式 在mysql中,如果在update和delete没有加上where条件,数据将会全部修改.不只是初识mysql的开发者会遇到这个问题,工作有一定经验的工程师难免也会忘记写入where条 ...

  8. eclipse集成testng插件

    一.TestNG简介 TestNG是一个开源自动化测试框架,它受到JUnit和NUnit的启发,而引入了许多新的创新功能,如依赖测试,分组概念,使测试更强大,更容易做到. 它旨在涵盖所有类别的测试:单 ...

  9. thinkphp5简单使用redis缓存

    <?php namespace app\index\controller; use think\Controller; use think\Cache\Driver\Redis; class I ...

  10. 深度解析Java内存原型

    一.Java 虚拟机内存原型 寄存器:我们在程序中无法控制. 栈:存放基本类型的数据和对象的引用,但对象本身不存放在栈中,而是存放在堆中. 堆:存放用new产生的数据. 静态域:存放在对象中用stat ...