赞
踩
IDEA
maven
1.创建一个普通的java maven 工程
2.选择maven 选择下一步
3.设置你的工程名,下一步
4.选择好大的工程包,点击完成
5.选择在新的窗口打开建好的工程
6.选择自动,米面手动配置的麻烦
- <?xml version="1.0" encoding="UTF-8"?>
- <project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-parent</artifactId>
- <version>2.0.1.RELEASE</version>
- </parent>
-
- <groupId>com.alibaba</groupId>
- <artifactId>springboot_demo01</artifactId>
- <version>1.0-SNAPSHOT</version>
-
-
- <dependencies>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-web</artifactId>
- </dependency>
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- </dependency>
-
- </dependencies>
-
- </project>
1.在工程的java目录新建springboot的引导类 com.alibaba.MySpringBootApplication
代码如下
- package com.alibaba;
-
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
-
- /**
- * @author Jiapeng Pang
- * @Position 大数据工程师
- * @date 2019/8/10 16:45.
- */
- @SpringBootApplication
- public class MySpringBootApplication {
-
- public static void main(String[] args) {
- SpringApplication.run(MySpringBootApplication.class);
- }
-
-
-
- }
启动main方法
访问浏览器
1.在com.alibaba下面新建controller包,创建 MyController.class
2.编写代码
- package com.alibaba.controller;
-
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.ResponseBody;
-
- /**
- * @author Jiapeng Pang
- * @Position 大数据工程师
- * @date 2019/8/10 16:57.
- */
- @Controller
- @ResponseBody
- public class MyController {
-
- @RequestMapping(value = "/testBrow")
- public String testBrow(){
- return "springboot访问成功!";
- }
-
-
- }
浏览器输入地址http://localhost:8080/testBrow再次测试
-------------------------------------------------------------------------------------------------------
在顺利时埋头前行
在挫败时不忘初心
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。