代码拉取完成,页面将自动刷新
[TOC]
1.基本尝试
2.banner
3.server.port
4.server.context-path/contextPath/CONTEXT_PATH
@Value("${book.author}")
private String bookAuthor;
@Value("${book.name}")
private String bookName;
@Component
@ConfigurationProperties(prefix = "author", locations = {"classpath:config/author.properties"})
public class AuthorSettings {
private String name;
private Long age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getAge() {
return age;
}
public void setAge(Long age) {
this.age = age;
}
}
spring.profiles.active=dev
<dependency>
<groupId>person.zt</groupId>
<artifactId>spring-boot-starter-hello</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
@Configuration
@EnableConfigurationProperties(HelloServiceProperties.class)
@ConditionalOnClass(HelloService.class)
@ConditionalOnProperty(prefix = "hello", value = "enabled", matchIfMissing = true)
public class HelloServiceAutoConfiguration {
@Autowired
private HelloServiceProperties helloServiceProperties;
@Bean
@ConditionalOnMissingBean(HelloService.class)
public HelloService helloService(){
System.out.println(">>>>我的自动配置开始生成 HelloService 的Bean了!!!");
HelloService helloService = new HelloService();
helloService.setMsg(helloServiceProperties.getMsg());
return helloService;
}
}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
person.zt.spring_boot_starter_hello.HelloServiceAutoConfiguration
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。