接上篇笔记,我们在pom.xml文件添加如下依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
然后在SpringbootApplication
中添加:
@RequestMapping("/")
String home() {
return "Hello World! Welcome to know Spring Boot";
}
修改端口(避免出现端口占用)
打开/springboot/src/main/resources/application.properties
添加:
server.port=8123
启动项目:
然后在浏览器中访问:
http://localhost:8123/