package com.example.demospringbootstarter.config;
import com.example.demospringbootstarter.service.AnimalService;
import com.example.demospringbootstarter.service.CatService;
import com.example.demospringbootstarter.service.DogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @Project: demo-spring-boot-starter
* @Description:
* @Author: chengjiangbo
* @Date: 2023/2/7 14:48
*/
@Configuration
@EnableConfigurationProperties(AnimalProperties.class)
public class AnimalAutoConfig {
@Autowired
private AnimalProperties animalProperties;
@Bean
public AnimalService demoService(){
switch (animalProperties.getName()){
case "cat":
return new CatService();
case "dog":
return new DogService();
default:
return null;
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
spring-boot自定义starter的源码示例
共61个文件
xml:41个
java:5个
class:5个
需积分: 0 4 下载量 91 浏览量
2023-02-07
20:42:22
上传
评论
收藏 41KB ZIP 举报
温馨提示
spring-boot自定义starter的源码示例
资源推荐
资源详情
资源评论
收起资源包目录
demo-spring-boot-starter.zip (61个子文件)
demo-spring-boot-starter
HELP.md 1KB
pom.xml 2KB
src
main
resources
META-INF
spring.factories 125B
java
com
example
demospringbootstarter
service
AnimalService.java 232B
CatService.java 497B
DogService.java 407B
config
AnimalAutoConfig.java 1KB
AnimalProperties.java 389B
demo-spring-boot-starter.iml 5KB
.idea
jarRepositories.xml 2KB
uiDesigner.xml 9KB
libraries
Maven__com_fasterxml_jackson_datatype_jackson_datatype_jsr310_2_11_2.xml 695B
Maven__org_springframework_boot_spring_boot_starter_tomcat_2_3_4_RELEASE.xml 741B
Maven__org_springframework_boot_spring_boot_starter_web_2_3_4_RELEASE.xml 720B
Maven__com_fasterxml_jackson_core_jackson_databind_2_11_2.xml 630B
Maven__com_fasterxml_jackson_core_jackson_core_2_11_2.xml 602B
Maven__org_springframework_boot_spring_boot_autoconfigure_2_3_4_RELEASE.xml 734B
Maven__ch_qos_logback_logback_core_1_2_3.xml 547B
Maven__org_springframework_boot_spring_boot_starter_logging_2_3_4_RELEASE.xml 748B
Maven__org_springframework_boot_spring_boot_starter_2_3_4_RELEASE.xml 692B
Maven__com_fasterxml_jackson_datatype_jackson_datatype_jdk8_2_11_2.xml 681B
Maven__org_slf4j_jul_to_slf4j_1_7_30.xml 534B
Maven__org_projectlombok_lombok_1_18_12.xml 531B
Maven__org_apache_logging_log4j_log4j_api_2_13_3.xml 573B
Maven__org_springframework_spring_expression_5_2_9_RELEASE.xml 658B
Maven__org_slf4j_slf4j_api_1_7_30.xml 513B
Maven__org_springframework_spring_jcl_5_2_9_RELEASE.xml 609B
Maven__org_springframework_spring_webmvc_5_2_9_RELEASE.xml 630B
Maven__org_springframework_spring_core_5_2_9_RELEASE.xml 616B
Maven__ch_qos_logback_logback_classic_1_2_3.xml 568B
Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml 633B
Maven__com_fasterxml_jackson_core_jackson_annotations_2_11_2.xml 651B
Maven__com_fasterxml_jackson_module_jackson_module_parameter_names_2_11_2.xml 736B
Maven__org_springframework_spring_context_5_2_9_RELEASE.xml 637B
Maven__org_springframework_spring_beans_5_2_9_RELEASE.xml 623B
Maven__org_apache_tomcat_embed_tomcat_embed_websocket_9_0_38.xml 660B
Maven__org_yaml_snakeyaml_1_26.xml 495B
Maven__org_glassfish_jakarta_el_3_0_3.xml 529B
Maven__org_springframework_boot_spring_boot_starter_json_2_3_4_RELEASE.xml 727B
Maven__org_springframework_spring_web_5_2_9_RELEASE.xml 609B
Maven__org_springframework_spring_aop_5_2_9_RELEASE.xml 609B
Maven__org_springframework_boot_spring_boot_2_3_4_RELEASE.xml 636B
Maven__org_apache_logging_log4j_log4j_to_slf4j_2_13_3.xml 608B
Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_38.xml 625B
workspace.xml 4KB
misc.xml 451B
compiler.xml 861B
modules.xml 295B
.gitignore 250B
encodings.xml 191B
target
classes
META-INF
spring.factories 121B
com
example
demospringbootstarter
service
DogService.class 695B
AnimalService.class 186B
CatService.class 695B
config
AnimalProperties.class 2KB
AnimalConfig.class 1KB
maven-status
maven-compiler-plugin
compile
default-compile
createdFiles.lst 304B
inputFiles.lst 599B
demo-spring-boot-starter-0.0.4-SNAPSHOT.jar 6KB
maven-archiver
pom.properties 82B
generated-sources
annotations
.gitignore 395B
共 61 条
- 1
资源评论
令狐前生
- 粉丝: 122
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功