springboot project为什么Autowired注入失败,输出null

这是实体类


package com.shi.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Component
public class Dog {

    @Value("阿黄")
    private String name;
    @Value("18")
    private Integer age;

}

这是测试类

package com.shi;
import com.shi.pojo.Dog;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class SpringbootTest {
    @Autowired //将狗狗自动注入进来
    Dog dog;

    @Test
    public void contextLoads() {
        System.out.println(dog); //打印狗狗对象
    }

}

应该是注入了的啊,结果打印却输出null,这是为啥啊

SpringbootTest 测试类加上@RunWith(SpringRunner.class)

@Autowired注解都没加载,谁给你做注入

直接启动项目 已运行结果为准