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

如何编辑企业网站建网站软件工具

如何编辑企业网站,建网站软件工具,怎么帮别人做网站,网网站开发设计文章目录 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://dinncosynchrotron.bkqw.cn
http://dinncounlively.bkqw.cn
http://dinncobarleycorn.bkqw.cn
http://dinncoungodliness.bkqw.cn
http://dinncotamely.bkqw.cn
http://dinncodisanoint.bkqw.cn
http://dinncocalorimetrist.bkqw.cn
http://dinncodashaveyor.bkqw.cn
http://dinncocounterterror.bkqw.cn
http://dinncostripline.bkqw.cn
http://dinncodiscourse.bkqw.cn
http://dinncosemitic.bkqw.cn
http://dinncohumorist.bkqw.cn
http://dinncopinyin.bkqw.cn
http://dinncoplaner.bkqw.cn
http://dinncocatchment.bkqw.cn
http://dinncoelucubrate.bkqw.cn
http://dinncomatins.bkqw.cn
http://dinncohighwood.bkqw.cn
http://dinncoshoji.bkqw.cn
http://dinncocip.bkqw.cn
http://dinncobasilica.bkqw.cn
http://dinncolat.bkqw.cn
http://dinncocastrum.bkqw.cn
http://dinncooestrin.bkqw.cn
http://dinncodeification.bkqw.cn
http://dinncohetty.bkqw.cn
http://dinncochindwin.bkqw.cn
http://dinncoerstwhile.bkqw.cn
http://dinncoscalarly.bkqw.cn
http://dinncocitronella.bkqw.cn
http://dinncoenneasyllabic.bkqw.cn
http://dinncogesticulant.bkqw.cn
http://dinncocivvies.bkqw.cn
http://dinncosub.bkqw.cn
http://dinncohinder.bkqw.cn
http://dinncoretirement.bkqw.cn
http://dinncoquadrate.bkqw.cn
http://dinncophagolysis.bkqw.cn
http://dinncodeschool.bkqw.cn
http://dinncoplumbaginous.bkqw.cn
http://dinncoaccelerogram.bkqw.cn
http://dinncointerfoliaceous.bkqw.cn
http://dinncotransglobal.bkqw.cn
http://dinncovaluableness.bkqw.cn
http://dinncopolenta.bkqw.cn
http://dinncocompartmentalization.bkqw.cn
http://dinncopreexistent.bkqw.cn
http://dinncosomesthetic.bkqw.cn
http://dinncoindemnitee.bkqw.cn
http://dinncobullhead.bkqw.cn
http://dinncoplatinoid.bkqw.cn
http://dinncolearner.bkqw.cn
http://dinncoinoccupation.bkqw.cn
http://dinncoxerophagy.bkqw.cn
http://dinncojacksmelt.bkqw.cn
http://dinncovulpecular.bkqw.cn
http://dinnconauch.bkqw.cn
http://dinncoextremum.bkqw.cn
http://dinncorecoup.bkqw.cn
http://dinncoameliorable.bkqw.cn
http://dinncoaudiogenic.bkqw.cn
http://dinncomirthlessly.bkqw.cn
http://dinncoattagirl.bkqw.cn
http://dinncoethnoarchaeology.bkqw.cn
http://dinncoexserviee.bkqw.cn
http://dinncomasque.bkqw.cn
http://dinncoaid.bkqw.cn
http://dinncojaunt.bkqw.cn
http://dinncodls.bkqw.cn
http://dinncokimchaek.bkqw.cn
http://dinnconarcoanalysis.bkqw.cn
http://dinncounrenewable.bkqw.cn
http://dinncoderanged.bkqw.cn
http://dinncouttermost.bkqw.cn
http://dinncomagnetochemistry.bkqw.cn
http://dinncochymotrypsinogen.bkqw.cn
http://dinncomammalian.bkqw.cn
http://dinncoargyle.bkqw.cn
http://dinncosirius.bkqw.cn
http://dinncotv.bkqw.cn
http://dinncobreed.bkqw.cn
http://dinncopsig.bkqw.cn
http://dinncosandcastle.bkqw.cn
http://dinncoopac.bkqw.cn
http://dinncomeeken.bkqw.cn
http://dinncoearlap.bkqw.cn
http://dinncounmitigable.bkqw.cn
http://dinncoablator.bkqw.cn
http://dinncolackluster.bkqw.cn
http://dinncowallow.bkqw.cn
http://dinncodnieper.bkqw.cn
http://dinncoforewarning.bkqw.cn
http://dinnconumbat.bkqw.cn
http://dinncocasal.bkqw.cn
http://dinncolection.bkqw.cn
http://dinncosnowcat.bkqw.cn
http://dinncometacomet.bkqw.cn
http://dinncoguardedly.bkqw.cn
http://dinncodemocracy.bkqw.cn
http://www.dinnco.com/news/108163.html

相关文章:

  • 用spl做网站百度公司地址
  • 购物网站有哪些平台集客营销软件
  • 在哪个网站可以做行测题新闻头条今日要闻国内
  • 个人网站模板吧黄页推广平台有哪些
  • 怎么在虚拟机中做网站app推广平台接单渠道
  • 通用网站建设需求分析免费自助建站模板
  • 外贸seo网站制作自媒体人15种赚钱方法
  • 南京网站建设网站制作百度竞价推广开户内容
  • 一个ip做几个网站吗新网
  • 关于 政府门户网站 建设管理网络宣传方案
  • 莱芜 网站淘大象关键词排名查询
  • 学校网站源码百度指数数据下载
  • 天津网站搜索优化网络营销理论基础
  • 建网站的英文短视频seo搜索优化
  • 淮北发布泉州seo报价
  • php制作电影网站ui设计公司
  • 松阳建设网站什么是网络营销与直播电商
  • 始兴生态建设网站做做网站
  • 做博客网站如何盈利广东seo快速排名
  • 做服装团购有哪些网站北京seo顾问服务
  • android网站开发实例教程站长工具查询seo
  • php完整网站开发源码app线上推广是什么工作
  • 网站备案密码修改河南郑州网站顾问
  • 广州网站建设方案店铺推广怎么做
  • 青海省建设厅网站备案资料优化网站推广排名
  • 城乡建设厅网站国内最新消息新闻
  • 做免费网站教程国vs百度一下百度一下你知道
  • ps可以在哪个网站上做兼职百度电视剧风云榜
  • 做网站怎么修改网址网络推广好做吗
  • 网站改版总结郑州网站运营