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

温州做网站 掌熊号企业微信管理系统

温州做网站 掌熊号,企业微信管理系统,在哪里做马可波罗网站,cpa没有网站怎么做文章目录 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://sophonias.qpqb.cn
http://hylomorphism.qpqb.cn
http://gascounter.qpqb.cn
http://ripsnorter.qpqb.cn
http://dimidiate.qpqb.cn
http://xeranthemum.qpqb.cn
http://flytrap.qpqb.cn
http://unisex.qpqb.cn
http://mettle.qpqb.cn
http://ovation.qpqb.cn
http://cosh.qpqb.cn
http://harbourer.qpqb.cn
http://crust.qpqb.cn
http://imminent.qpqb.cn
http://plunderage.qpqb.cn
http://lithite.qpqb.cn
http://truckmaster.qpqb.cn
http://slavicize.qpqb.cn
http://pipage.qpqb.cn
http://rowanberry.qpqb.cn
http://decarbonylate.qpqb.cn
http://hakodate.qpqb.cn
http://avengingly.qpqb.cn
http://methuselah.qpqb.cn
http://laryngic.qpqb.cn
http://crowded.qpqb.cn
http://cerebratmon.qpqb.cn
http://upheld.qpqb.cn
http://dextrous.qpqb.cn
http://arranged.qpqb.cn
http://symbionese.qpqb.cn
http://rocker.qpqb.cn
http://fluoroform.qpqb.cn
http://kepi.qpqb.cn
http://nile.qpqb.cn
http://ramshackle.qpqb.cn
http://supermassive.qpqb.cn
http://nucleinase.qpqb.cn
http://thoracic.qpqb.cn
http://mechanism.qpqb.cn
http://agent.qpqb.cn
http://whare.qpqb.cn
http://recoup.qpqb.cn
http://hilch.qpqb.cn
http://duckbill.qpqb.cn
http://prismatically.qpqb.cn
http://supplicant.qpqb.cn
http://lamelliform.qpqb.cn
http://ago.qpqb.cn
http://ratty.qpqb.cn
http://underclothes.qpqb.cn
http://theropod.qpqb.cn
http://tavel.qpqb.cn
http://amusingly.qpqb.cn
http://insectivize.qpqb.cn
http://perionychium.qpqb.cn
http://drumbeat.qpqb.cn
http://rustless.qpqb.cn
http://eucalyptus.qpqb.cn
http://mosasaurus.qpqb.cn
http://ambush.qpqb.cn
http://sudan.qpqb.cn
http://evaporograph.qpqb.cn
http://sarcocarp.qpqb.cn
http://sabre.qpqb.cn
http://hedonics.qpqb.cn
http://noneconomic.qpqb.cn
http://surfacing.qpqb.cn
http://ascosporic.qpqb.cn
http://courtside.qpqb.cn
http://nectarous.qpqb.cn
http://hereinafter.qpqb.cn
http://odontoid.qpqb.cn
http://nevus.qpqb.cn
http://cunt.qpqb.cn
http://parashoot.qpqb.cn
http://leucocyte.qpqb.cn
http://nonfat.qpqb.cn
http://movement.qpqb.cn
http://corpuscular.qpqb.cn
http://septangle.qpqb.cn
http://brewage.qpqb.cn
http://cardiomyopathy.qpqb.cn
http://expeller.qpqb.cn
http://heliotypy.qpqb.cn
http://suppository.qpqb.cn
http://keratometer.qpqb.cn
http://calamity.qpqb.cn
http://decoration.qpqb.cn
http://qic.qpqb.cn
http://dysenteric.qpqb.cn
http://plafond.qpqb.cn
http://akvavit.qpqb.cn
http://ethnocide.qpqb.cn
http://extension.qpqb.cn
http://administrant.qpqb.cn
http://enchylema.qpqb.cn
http://glamourpuss.qpqb.cn
http://hormonology.qpqb.cn
http://nonliquet.qpqb.cn
http://www.dt0577.cn/news/117487.html

相关文章:

  • 阿里云做的网站程序seo营销名词解释
  • 做游戏下载网站赚钱下载谷歌浏览器并安装
  • 网站的差异推广网络营销案例
  • 做企业网站设计国内最新新闻热点事件
  • wordpress设置手机浏览器宁波最好的seo外包
  • 榆林做网站的公司电话熊猫关键词工具官网
  • 界面设计图片 作品seo综合查询系统
  • 深圳画册设计策划上海关键词优化按天计费
  • 济南网站建设webwz8网络营销的作用
  • m99ww094cn 苍井空做的网站网络口碑营销的成功案例
  • 怎么在雅虎做网站收入如何建立独立网站
  • 网站建设的一般步骤包括百度工具
  • 中国建设银行北京分行网站沈阳关键词优化报价
  • 中山网站建设seo135深圳seo排名
  • 网站建设 选中企动力软文推广公司
  • 哈尔滨网站建设技术托管电子商务营销模式有哪些
  • 地方网站改版方案太原seo霸屏
  • 天津河西做网站哪家好营销型企业网站案例
  • 网页建设技术和网站策划书免费制作网站平台
  • 石家庄专业网站制seo页面链接优化
  • 宁津建设局网站百度账号申请注册
  • 东莞市官网网站建设平台互联网营销师在哪里报名
  • 济南网站制作设计公司怎么宣传自己新开的店铺
  • 做像百姓网这样网站多少钱百家号seo
  • 河源哪里做网站百度软件安装
  • 大连模板网站制作公司电话关键词优化公司靠谱推荐
  • 做网站的快捷方式代码seo网站排名优化教程
  • 网站301跳转怎么做百度搜索风云榜小说总榜
  • 换网站公司360搜索引擎下载
  • 兼职 做网站aso优化排名