您当前的位置: 首页 >  ide

喜欢猪猪

暂无认证

  • 2浏览

    0关注

    228博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

使用IDEA创建一个Meaven项目

喜欢猪猪 发布时间:2020-02-06 12:37:07 ,浏览量:2

配置文件的处理操作,pom.xml


    4.0.0

    org.example
    com.atwanle
    3.0-SNAPSHOT
    
    
        org.springframework.boot
        spring-boot-starter-parent
        2.2.4.RELEASE
    
    
    
        
            org.springframework.boot
            spring-boot-starter-web
        
    
    
    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    

 

main方法的使用创建处理

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class helloWorld {
   public static void main(String[] args)
   {
      //启动spring主方法
      SpringApplication.run(helloWorld.class,args);
   }
}

 

创建一个控制器进行web的页面相应 操作

package wenle.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController
{
    @RequestMapping("/hello")
    @ResponseBody
    public String hello()
    {
        return "hello world!";
    }
}

如果运行的时候端口被占用的话,创建一个配置文件,配置以下其他的端口进行处理。

运行结果

关注
打赏
1648795721
查看更多评论
立即登录/注册

微信扫码登录

0.0376s