SpringBoot的打包部署、版本仲裁

背景

   
    最近头发掉的厉害了,整理下SpringBoot系列及周边的技术,总的来看分为配置、日志、web、docker、数据访问、缓存、消息、检索、任务、安全、分布式、开发习惯、监控等,慢慢更新
  

简介

    为了简化开发,尊崇约定大于配置的思想,干掉复杂的配置,让咱码农能把精力都用在开发上。

上手

  1.     IDEA-创建项目-引入依赖
		<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
  1.     IDEA生成了启动类
@SpringBootApplication
public class DemoApplication {
   

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

}
  1.     编写controller
    controller
@RestController
public class HelloController {
   

    @RequestMapping("/hello")
    public String getHello(){
   
        return "Hello! SpringBoot";
    }
}

  这里的 @RestController 来看一下

@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Controller
@ResponseBody
public @interface RestController {
   

	/**
	 * The value may indicate a suggestion for a logical component name,
	 * to be turned into a Spring bean in case of an autodetected component.
	 * @return the suggested component name, if any (or empty String otherwise)
	 * @since 4.0.1
	 */
	@AliasFor(annotation = Controller.class)
	String value() default "";

}

    这里边放了@ResponseBody注解,所以HelloController 里边所有的方法都不用再写@ResponseBody注解了

  1.     启动项目并访问
  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值