SpringBoot三大开发工具,你都用过么?
Java技术江湖
共 2566字,需浏览 6分钟
·
2022-01-21 07:03
点击上方“Java技术江湖”,选择“设为星标”
回复”666“获取全网最热的Java核心知识点整理
<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-devtoolsartifactId>
<optional>trueoptional>
dependency>
1.在idea的setting中把下面的勾都打上
2.进入pom.xml,在build的反标签后给个光标,然后按Alt+Shift+ctrl+/
3.然后勾选下面的东西,接着重启idea即可
二、Lombok
<dependency>
<groupId>org.projectlombokgroupId>
<artifactId>lombokartifactId>
<optional>trueoptional>
dependency>
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@AllArgsConstructor//全参构造器
@NoArgsConstructor//无参构造器
@Data//getter + setter
public class User {
private Long id;
private String name;
private Integer age;
private String email;
}
三、Spring Configuration Processor
package org.lzl.HelloWorld.entity;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @author Lenovo
*
*/
@Component
@ConfigurationProperties(prefix = "mypet")
public class Pet {
private String nickName;
private String strain;
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getStrain() {
return strain;
}
public void setStrain(String strain) {
this.strain = strain;
}
@Override
public String toString() {
return "Pet [nickName=" + nickName + ", strain=" + strain + "]";
}
}
application.properties
和application.yml
中给mypet注入属性,却没有任何的提示,为了解决这一问题,我们在创建SpringBoot的时候勾选下面的场景:<dependency>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-configuration-processorartifactId>
<optional>trueoptional>
dependency>
<build>
<plugins>
<plugin>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-maven-pluginartifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.springframework.bootgroupId>
<artifactId>spring-boot-configuration-processorartifactId>
exclude>
excludes>
configuration>
plugin>
plugins>
build>
西安一码通,预算2580万,分包387万,执行27万?
Java 18 都要来了,你不会还在用Java 8吧?
面试官:有了 for 循环 为什么还要 forEach ?
关注公众号【Java技术江湖】后回复“PDF”即可领取200+页的《Java工程师面试指南》
强烈推荐,几乎涵盖所有Java工程师必知必会的知识点,不管是复习还是面试,都很实用。
评论