1. MyEclipse搭建SpringBoot

1.创建一个maven项目,在pom.xml中添加springboot依赖

   <!--在 <dependencies>的上面 添加SpringBoot的parent配置 -->
  <parent>
  		<groupId>org.springframework.boot</groupId>
  		<artifactId>spring-boot-starter-parent</artifactId>
  		<version>2.1.7.RELEASE</version>
  		<relativePath/>
  </parent>
  
    
    <!-- 引入springboot依赖 -->
    <dependency>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-web</artifactId>
    </dependency>

2.在src/main/resources中创建 application.yml文件

#修改端口号
server:
  port: 8099

3.在src/main/java 下创建springboot启动类

@SpringBootApplication
@ComponentScan("com.hncg.*") //扫描注解
public class BootApplication {

	public static void main(String[] args) {
		SpringApplication.run(BootApplication.class, args);
	}
	
}

4.创建TestController类测试

@RestController
public class TestController {
	
	@RequestMapping("test")
	public String test(){
		
		return "springboot测试........";
	}
}

右键项目 Run As  -->  Spring Boot App 启动,访问localhost:8099/test

1. MyEclipse搭建SpringBoot

上一篇:MyEclipse中文注释乱码解决


下一篇:React篇-子组件调用父组件方法,并传值