Article From:https://www.cnblogs.com/thyHome/p/9245827.html

 

Custom start dependency steps:

 

1、  Add the configuration annotation file

 

–          Specify what condition the configuration is loaded

–          Using enableconfigurationProperties to annotate the specified parameter configuration file

–          Injecting configurationProperties annotation file through constructor (other methods can also be used).

–          Use conditionalOnMissingBean annotation to create default bean instances and import default parameters.

 

2、  Add configurationProperties to annotate file configuration parameters

 

–          Specify the configuration path of the YML configuration file

–          Configuring the default parameters for the specified path in the file

 

3、   

1)       Configuration in resources/ META-INF/ spring.factories file is not a default application file.

 

Define the full path of the startup class and the full path of the custom boot class, for example:

1 org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 cn.thyonline.house.autoconfig.HttpCientAutofiguration
 
2)       Write the annotation annotation class

 

–          @Target(ElementType.TYPE)

–          @Retention(RetentionPolicy.RUNTIME)

–          @Import(Custom start.Class)

–          In the main boot class, use the note @ the startup class that has just been written.

Leave a Reply

Your email address will not be published. Required fields are marked *