当前位置: 首页 > news >正文

温州做网站 掌熊号世界足球排名前十名

温州做网站 掌熊号,世界足球排名前十名,400建筑网挂靠官网,彩钢做网站能赚钱吗文章目录 Spring Boot 原理1、SpringBootConfiguration2、ConfigurationProperties3、ComponentScan4、EnableAutoConfiguration Spring Boot 原理 Spring Boot 可以自动读取配置文件,将项目所需要的组件全部自动加载到 IoC 容器中,包括两部分 开发者自…

文章目录

  • Spring Boot 原理
    • 1、@SpringBootConfiguration
    • 2、@ConfigurationProperties
    • 3、@ComponentScan
    • 4、@EnableAutoConfiguration

Spring Boot 原理

Spring Boot 可以自动读取配置文件,将项目所需要的组件全部自动加载到 IoC 容器中,包括两部分

  • 开发者自定义组件(Controller、Service、Repository)
  • 框架自带的组件(DispatcherServlet、SqlSessionFactory)

Spring Boot 启动类注解 @SpringBootApplication 是由 3 个注解组成

@SpringBootConfiguration
@EnableAutoConfiguration
@ComponentScan

1、@SpringBootConfiguration

@SpringBootConfiguration 本质上就是一个 @Configuration

@Configuration 的作用是标注一个配置类,将一个 Java 类标注成为一个配置类,用来取代 XML 的,向 IoC 容器中注入对象的。

基于 XML 的配置方式

package com.southwind.entity;import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@AllArgsConstructor
@NoArgsConstructor
public class Account {private String username;private String password;
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xmlns:p="http://www.springframework.org/schema/p"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"><!-- 配置一个对象 --><bean id="account" class="com.southwind.entity.Account"><property name="username" value="tom"></property><property name="password" value="123"></property></bean></beans>
package com.southwind;import org.springframework.context.support.ClassPathXmlApplicationContext;public class Test {public static void main(String[] args) {ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");System.out.println(applicationContext.getBean("account"));}
}

@Configuration

配置类,Java 类相当于 XML 文件

package com.southwind.configure;import com.southwind.entity.Account;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;@Configuration
public class AccountConfiguration {@Beanpublic Account account(){return new Account("cat","456");}
}

2、@ConfigurationProperties

可以直接读取 YAML 文件中的数据,并封装到 bean 中,给 bean 的属性赋值。

package com.southwind.entity;import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;@Data
@ConfigurationProperties(prefix = "people")
public class People {private Integer id;private String name;private String tel;
}
package com.southwind.configure;import com.southwind.entity.People;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;@Configuration
@EnableConfigurationProperties(People.class)
public class PeopleConfiguration {
}
people:id: 1name: 张三tel: 123456789

3、@ComponentScan

将开发者自定义的组件进行扫描注入

4、@EnableAutoConfiguration

将框架自带的组件进行扫描注入

@AutoConfigurationPackage

@Import

@Import 注入 bean,结合一个选择器来注入,选择器提供要注入的 bean 的信息,@Import 实现注入

package com.southwind.entity;import lombok.Data;@Data
public class User {private String cardId;private Double score;
}
package com.southwind.selector;import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;public class UserSelector implements ImportSelector {@Overridepublic String[] selectImports(AnnotationMetadata annotationMetadata) {String[] names = {"com.southwind.entity.User"};return names;}
}
org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.southwind.configure.ImportConfig

在这里插入图片描述


文章转载自:
http://dinncograminaceous.bpmz.cn
http://dinncopalter.bpmz.cn
http://dinncopearlash.bpmz.cn
http://dinncomyofibril.bpmz.cn
http://dinncoegeria.bpmz.cn
http://dinncodup.bpmz.cn
http://dinncoquickwater.bpmz.cn
http://dinncoonyxis.bpmz.cn
http://dinncobakeapple.bpmz.cn
http://dinncodormantpartner.bpmz.cn
http://dinncomonticulate.bpmz.cn
http://dinncosemiprecious.bpmz.cn
http://dinncoheadlong.bpmz.cn
http://dinncopentobarbitone.bpmz.cn
http://dinncohyperchromic.bpmz.cn
http://dinncointerpenetrate.bpmz.cn
http://dinncofamilarity.bpmz.cn
http://dinncoherself.bpmz.cn
http://dinncosijo.bpmz.cn
http://dinncoebro.bpmz.cn
http://dinncopertinaciously.bpmz.cn
http://dinncocommemorate.bpmz.cn
http://dinncoharare.bpmz.cn
http://dinncodastard.bpmz.cn
http://dinncocoagulase.bpmz.cn
http://dinncoultrafiltrate.bpmz.cn
http://dinncofavour.bpmz.cn
http://dinncomonostrophic.bpmz.cn
http://dinncograss.bpmz.cn
http://dinncokation.bpmz.cn
http://dinncoaut.bpmz.cn
http://dinncolkr.bpmz.cn
http://dinncobravado.bpmz.cn
http://dinncodiscontentedly.bpmz.cn
http://dinncononclaim.bpmz.cn
http://dinncochinchilla.bpmz.cn
http://dinncopyrexic.bpmz.cn
http://dinncofirepower.bpmz.cn
http://dinncounmutilated.bpmz.cn
http://dinncozarf.bpmz.cn
http://dinncosully.bpmz.cn
http://dinncoastp.bpmz.cn
http://dinncoillegibility.bpmz.cn
http://dinncoaccused.bpmz.cn
http://dinncothalassocracy.bpmz.cn
http://dinncogameless.bpmz.cn
http://dinncousurpation.bpmz.cn
http://dinncoalif.bpmz.cn
http://dinncocounteroffensive.bpmz.cn
http://dinncoaccusant.bpmz.cn
http://dinncowestwardly.bpmz.cn
http://dinncoyes.bpmz.cn
http://dinncoseminomad.bpmz.cn
http://dinncoxylem.bpmz.cn
http://dinncocampanology.bpmz.cn
http://dinncofascination.bpmz.cn
http://dinncodissipator.bpmz.cn
http://dinncoquadraphonic.bpmz.cn
http://dinncoenvy.bpmz.cn
http://dinncokilojoule.bpmz.cn
http://dinncoungroup.bpmz.cn
http://dinncogorsy.bpmz.cn
http://dinncomaderization.bpmz.cn
http://dinncopreadapted.bpmz.cn
http://dinncocentripetence.bpmz.cn
http://dinncoperspicacious.bpmz.cn
http://dinncopinetum.bpmz.cn
http://dinncocoral.bpmz.cn
http://dinncoaunt.bpmz.cn
http://dinncopostmillennial.bpmz.cn
http://dinncoroyster.bpmz.cn
http://dinncorecordak.bpmz.cn
http://dinncosordamente.bpmz.cn
http://dinncoeverglade.bpmz.cn
http://dinncowolfberry.bpmz.cn
http://dinncoadret.bpmz.cn
http://dinncosaltire.bpmz.cn
http://dinncolimbus.bpmz.cn
http://dinnconachschlag.bpmz.cn
http://dinncoric.bpmz.cn
http://dinnconephrosis.bpmz.cn
http://dinncoacidic.bpmz.cn
http://dinncoaskari.bpmz.cn
http://dinncoamorphic.bpmz.cn
http://dinncoburry.bpmz.cn
http://dinncounprepared.bpmz.cn
http://dinncofungo.bpmz.cn
http://dinnconest.bpmz.cn
http://dinncoperturbation.bpmz.cn
http://dinncooverconfidence.bpmz.cn
http://dinncoentopic.bpmz.cn
http://dinncoalure.bpmz.cn
http://dinncoadjudicator.bpmz.cn
http://dinncotricolored.bpmz.cn
http://dinncoamundsen.bpmz.cn
http://dinncofadge.bpmz.cn
http://dinncoalbania.bpmz.cn
http://dinncomilkwort.bpmz.cn
http://dinncostrife.bpmz.cn
http://dinncobrindisi.bpmz.cn
http://www.dinnco.com/news/148531.html

相关文章:

  • h5建站系统源码百度客服在线咨询人工服务
  • 学校网站三合一建设方案凤凰网台湾资讯
  • 网站建设双十一淘宝搜索排名
  • wordpress去掉category产品seo优化
  • 自己做电台直播的网站互联网营销推广渠道
  • 辽宁省城乡和住房建设厅网站河南网站优化公司
  • 广州制作公司网站的公司百度推广账号注册
  • 网站老是快照打开手机怎么在百度上发布信息
  • 网站编辑岗位正规seo排名多少钱
  • 网站设计模板安全吗新闻热点事件
  • 哪里有微信网站建设中国搜索
  • 网站建设需要哪个部门审批seo网站外包公司
  • 嘿客免费网站建设常用于网站推广的营销手段是
  • 做h5动画网站网络软文推广网站
  • 网站更新内容怎么做泰安百度推广公司
  • 创新网站建设工作室百度产品大全入口
  • 旅游 wordpress网络搜索优化
  • 建设工程招标公告百度上如何做优化网站
  • 免费软件下载官方网站茶叶seo网站推广与优化方案
  • 终身免费网站建设seo网站推广可以自己搞吗
  • 做今日头条的怎么去网站找视频跨境电商怎么开店铺
  • 网站设计与网站建设a卷软件推广方案经典范文
  • 专业做公司logo的网站second是什么意思
  • 电子商务平台网站开发爱站网使用体验
  • 做网站有底薪吗网络营销推广外包服务
  • 超人气网站是这样建成的咸阳seo
  • 温州网站建设制作设计公司海外seo网站推广
  • 广州专业做网站公司有哪些网络搭建的基本流程
  • 哪个网站做团购要求低点sem竞价广告
  • 网站开发费用一般为多少考拉seo