1.建立工程animal
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
BirdDemo.java
package
2.建立工程animal-spring-boot-starter
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
AninalAutoConfigure.java
package
AninalProperties.java
package
spring.factories
org.springframework.boot.autoconfigure.EnableAutoConfiguration =
com.andrick.animal.spring.boot.autoconfigure.AnimalAutoConfigure
3.引用 animal-spring-boot-starter
pom.xml
<dependency>
Controller增加
@Autowired
application.yml
com:
andrick:
name: chen
width: 10
length: 25
運作結果: