Java日志-Spring Boot(1)idea快速构建Spring Boot
来源:互联网 发布:HTML源码 编辑:程序博客网 时间:2024/06/11 19:12
对于Spring Boot博主也是个新手,希望可以跟大家一起学习一起进步
接下来我们使用idea构建一个简单的Spring Boot应用 “Hello World”
第一步:打开idea选择new project 选择Spring Initializr 点击next
第二步:选择必要的依赖,建议大家尽量跟我选择一样的吧
接下去就是next finish之类的 大家自己完成吧!
第四步:配置你的maven仓库,建议大家使用阿里云的maven仓库(极快无比),在你的maven中的setting.xml文件中的<mirrors>下写入
<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url></mirror>
第五部:写一个Controller吧
package com.example.controller;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;/** * Created by Administrator on 2017/2/14 0014. */@Controllerpublic class TestController { @RequestMapping("/") public String test(){ return "index"; }}注意:如果controller和你的application不在一个包的话可以通过以下配置来完成
package com.example;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;@SpringBootApplication(scanBasePackages = {"com.example.controller"})public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); }}
第六步:编辑一个thymeleaf页面吧,由于博主使用的是1.5.1的spring boot可能在集成thymeleaf模板时可能有点问题所以我们在配置文件中加入
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"><head> <title>Title</title></head><body> Hello world</body></html>
spring.session.store-type = none就完全没有问题啦
接下来是完整的项目结构
最后启动项目,感受springboot快速构建项目带来的快感吧 localhost:8080
第一次写博客,好心累!!一直ctrl+s 哈哈哈
1 1
- Java日志-Spring Boot(1)idea快速构建Spring Boot
- Spring Boot(1)-快速构建应用
- 快速构建Spring Boot项目
- Spring Boot系列一----使用idea快速构建Spring boot项目
- spring boot (一)入门 启动、日志配置和快速构建
- 关于spring boot - 快速构建spring程序
- Spring Boot 快速入门 mac IDEA
- Spring Boot的快速搭建(IDEA)
- 使用IntelliJ IDEA中的Spring Initializr来快速构建Spring Boot/Cloud工程
- 01.Spring Cloud学习笔记之使用IDEA+Spring Boot快速构建Rest服务
- IntelliJ IDEA 2017.2.5 x64中的Spring Initializr来快速构建Spring Boot/Cloud工程
- Spring boot—logback日志构建
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- Spring Boot框架快速构建应用
- Spring Boot快速构建我们的开发
- 使用Spring Boot快速构建应用
- 使用Spring Boot快速构建应用
- 一个web应用的诞生--数据存储
- (mysql) DDL常用总结
- [最小直径生成树 模板题] BZOJ 2180 最小直径生成树 & BZOJ 2182 [Spoj1479] TGK & Ural 1569 Networking the “Iset”
- Linux环境下查看jar包的归档目录
- touchID
- Java日志-Spring Boot(1)idea快速构建Spring Boot
- Go语言goroutine+channel+select简介
- python 列表相关小工具
- css 垂直居中
- Git下的冲突解决
- android studio 图片资源的放置位置和容易引发的问题
- LeetCode 82. Remove Duplicates from Sorted List II
- 开源框架
- QT学习(五)QT 连接 sqlite