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

中企动力做的网站怎么样网站排名优化制作

中企动力做的网站怎么样,网站排名优化制作,天津网站策划,柳州正规网站制作1.什么是Spring Spring框架是用于构建企业级Java的开源框架,他通过依赖注入和IOC容器帮我我们管理对象;支持AOP,将非业务功能(日志,事务等)从我们业务代码中分离出来,提高了代码的可维护性&…

1.什么是Spring

Spring框架是用于构建企业级Java的开源框架,他通过依赖注入和IOC容器帮我我们管理对象;支持AOP,将非业务功能(日志,事务等)从我们业务代码中分离出来,提高了代码的可维护性;提供了强大的事务管理支持,是开发人员不需要过多关注事务的控制;支持模块化设计,开发者可以根据需要选择不同的模块,例如MVC,SpringData;我们可以通过Spring方便整合其他的组件满足业务需要,Sprign的主要目标,就是简化开发,提高项目的可维护性。

2.Spring的核心模块有哪些

  1. Core Container:
    Spring的核心模块,主要提供IOC依赖注入功能的支持,对Bean对象的管理以及国际化,JMS消息服务,SPEL表达式等

SPEL表达式,主要用于配置文件和@Value注解

  1. AOP:
    提供了切面支持,将事务管理和日志等功能从业务逻辑中分离
  2. SpringDataAccess:
    支持对数据访问的支持,和对象关系映射,简化了使用JDBC访问数据库,支持了声明式事务简化开发
  3. SpringWeb:
    提供了SpringMVC的实现,支持webSocket等
  4. SpringTest:
    单元测试

3.Spring框架用到了哪些设计模式

  1. 工厂设计模式 : Spring 使用工厂模式通过 BeanFactory、ApplicationContext 创建 bean 对象。
  2. 代理设计模式:Spring的AOP功能的实现
  3. 单例设计模式:SpringBean都是默认单例的
  4. 模板方法模式:jdbcTemplate
  5. 适配器模式:SpringAOP的Advice,SpringMVC匹配Controller也使用了适配器模式

4.说一些Spring框架常用的注解有哪些

  1. @ComponentScan和@Component
    @ComponentScan会扫描加了@Component的类,并将这个类交给Spring容器管理
  2. @Controller控制层注解、@Service服务层注解、@Repository数据访问层注解
    本质上都是@Component,语义有所区别
  3. @Autowired和@Resource
    @Autowired是Spring提供的注解,按照类型进行装配
    @Resource是JDK提供的注解,默认按照名称装配,也可以指定按照类型
  4. @Configuration 声明当前类为配置类,可以替换xml配置文件
  5. @Bean
    将当前方法返回的Bean交给IOC容器管理,和@Component区别是
@Bean@Component
位置作用在方法上作用在类上
用途常用于在@Configuration定义的方法,方法返回的对象被注册成Bean交给Spring管理Spring会扫描加了@Configuration注解的类,并将他们注册为Bean
粒度可以更细粒度控制Bean,因为可以在方法中编写自定义的Bean配置的逻辑标识组件,只用于自动扫描注册,没有很惊喜的控制
  1. @Import :导入第三方包,或者导入配置类
@Configuration
public class AppConfig1 {@Beanpublic MyService myService() {return new MyService("Service from AppConfig1");}
}
@Configuration
public class AppConfig2 {@Beanpublic AnotherService anotherService() {return new AnotherService("AnotherService from AppConfig2");}
}
@Configuration
@Import({AppConfig1.class, AppConfig2.class})
public class MainConfig {}
public class MainApp {public static void main(String[] args) {ApplicationContext context = new AnnotationConfigApplicationContext(MainConfig.class);MyService myService = context.getBean(MyService.class);AnotherService anotherService = context.getBean(AnotherService.class);}
}
  1. @Value
    获取属性文件中的属性值

5.Spring、SpringMVC、SpringBoot有什么区别

SpringMVC是Spring的一个重要模块,帮助Spring构建MVC架构的能力,SpringBoot通过减少配置,开箱即用,简化了Spring的程序开发。

6.BeanFactory和FactoryBean有什么区别

  1. BeanFactory是Bean工厂,负责管理Bean的生命周期,是SpringIOC容器的和兴结构,ApplicationContext其实就是一种BeanFactory
        ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);// 通过 ApplicationContext 获取 Car 对象Car car = context.getBean(Car.class);
  1. FactoryBean也是一个bean,我们通过FactoryBean自定义Bean的生命周期
public class Car {private String brand;private String model;
}
class CarFactoryBean implements FactoryBean<Car> {private String brand;private String model;public void setBrand(String brand) {this.brand = brand;}public void setModel(String model) {this.model = model;}@Overridepublic Car getObject() throws Exception {// 在这里创建并返回实际的 Car 对象Car car = new Car();car.setBrand(brand);car.setModel(model);return car;}@Overridepublic Class<?> getObjectType() {return Car.class;}@Overridepublic boolean isSingleton() {return true;}
}
@Configuration
class AppConfig {@Beanpublic CarFactoryBean carFactoryBean() {CarFactoryBean factoryBean = new CarFactoryBean();factoryBean.setBrand("Toyota");factoryBean.setModel("Camry");return factoryBean;}
}
class MainApp {public static void main(String[] args) {ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);// 注意:获取 Car 对象时使用的是 beanName "carFactoryBean"Car car = context.getBean("carFactoryBean", Car.class);System.out.println(car);}
}

7.为什么不建议直接使用Spring的@Async

当在使用@Async时,如果不指定具体的线程池名称或者有多个线程池,那么其使用的是就是默认线程池SimpleAsyncTaskExecutor,而该线程池的默认配置为(在TaskExecutionProperties中)容量:Integer.MAX_VALUE,最大线程数:Integer.MAX_VALUE,因此不会重复利用线程,创建线程不会有限制,当线程数量到达一定程度之后,就会影响相应的性能了,因此在使用@Async注解时,最好使用自定义线程池
详情请看Spring面试大全@Async使用02

8.Spring中如何实现多环境配置

  1. 配置文件使用@Profile注解
// 开发环境配置
@Configuration
@Profile("dev")
public class DevConfig {}
//生产环境的特定配置
@Configuration
@Profile("prod")
public class ProdConfig {}
  1. 激活profile
    在配置文件中执行环境
spring:profiles:active: local

文章转载自:
http://buddle.hyyxsc.cn
http://bawdry.hyyxsc.cn
http://bugong.hyyxsc.cn
http://cattail.hyyxsc.cn
http://aerodonetics.hyyxsc.cn
http://allusion.hyyxsc.cn
http://ammonite.hyyxsc.cn
http://alforja.hyyxsc.cn
http://chekhovian.hyyxsc.cn
http://buhr.hyyxsc.cn
http://agroecological.hyyxsc.cn
http://bridgetown.hyyxsc.cn
http://capitulate.hyyxsc.cn
http://babylonia.hyyxsc.cn
http://brummie.hyyxsc.cn
http://bernardine.hyyxsc.cn
http://bargainer.hyyxsc.cn
http://appulsion.hyyxsc.cn
http://acotyledonous.hyyxsc.cn
http://burnt.hyyxsc.cn
http://artistry.hyyxsc.cn
http://archway.hyyxsc.cn
http://baronetage.hyyxsc.cn
http://chapeau.hyyxsc.cn
http://bathymetric.hyyxsc.cn
http://agenize.hyyxsc.cn
http://avi.hyyxsc.cn
http://astray.hyyxsc.cn
http://cephalopodous.hyyxsc.cn
http://alkali.hyyxsc.cn
http://bejeaned.hyyxsc.cn
http://barytic.hyyxsc.cn
http://canny.hyyxsc.cn
http://boiloff.hyyxsc.cn
http://accelerative.hyyxsc.cn
http://acqierement.hyyxsc.cn
http://adumbrant.hyyxsc.cn
http://abortionist.hyyxsc.cn
http://benzidine.hyyxsc.cn
http://cassette.hyyxsc.cn
http://bonesetter.hyyxsc.cn
http://antiauthoritarian.hyyxsc.cn
http://bespeckle.hyyxsc.cn
http://carrierbased.hyyxsc.cn
http://anisotropism.hyyxsc.cn
http://catsup.hyyxsc.cn
http://antituberculous.hyyxsc.cn
http://castanets.hyyxsc.cn
http://allow.hyyxsc.cn
http://catabaptist.hyyxsc.cn
http://biquadratic.hyyxsc.cn
http://boycott.hyyxsc.cn
http://acalycine.hyyxsc.cn
http://carbonicacid.hyyxsc.cn
http://capuche.hyyxsc.cn
http://antiphony.hyyxsc.cn
http://anyhow.hyyxsc.cn
http://ballroomology.hyyxsc.cn
http://caramelize.hyyxsc.cn
http://caravaneer.hyyxsc.cn
http://absonant.hyyxsc.cn
http://arboriculture.hyyxsc.cn
http://balkanite.hyyxsc.cn
http://analcite.hyyxsc.cn
http://bachelordom.hyyxsc.cn
http://antipole.hyyxsc.cn
http://aleutian.hyyxsc.cn
http://cheero.hyyxsc.cn
http://acoustooptics.hyyxsc.cn
http://blackjack.hyyxsc.cn
http://campy.hyyxsc.cn
http://cannulate.hyyxsc.cn
http://amelioration.hyyxsc.cn
http://biopsy.hyyxsc.cn
http://agued.hyyxsc.cn
http://autocatalytically.hyyxsc.cn
http://advolution.hyyxsc.cn
http://biomathematics.hyyxsc.cn
http://acerous.hyyxsc.cn
http://boswellian.hyyxsc.cn
http://athwartships.hyyxsc.cn
http://bokhara.hyyxsc.cn
http://boil.hyyxsc.cn
http://bucketful.hyyxsc.cn
http://bodley.hyyxsc.cn
http://bushbeater.hyyxsc.cn
http://angelically.hyyxsc.cn
http://aseptic.hyyxsc.cn
http://ambiance.hyyxsc.cn
http://asexualize.hyyxsc.cn
http://behove.hyyxsc.cn
http://armistice.hyyxsc.cn
http://arenation.hyyxsc.cn
http://beja.hyyxsc.cn
http://blindage.hyyxsc.cn
http://anthemion.hyyxsc.cn
http://autotomize.hyyxsc.cn
http://benefactive.hyyxsc.cn
http://advantageous.hyyxsc.cn
http://bogey.hyyxsc.cn
http://www.tj-hxxt.cn/news/37597.html

相关文章:

  • wordpress插件密钥服务器临沂seo
  • 淡水网站建设公司百度app下载安装普通下载
  • 本地做织梦网站微博seo营销
  • 做网站的详细教程搜索风云榜
  • 平台下载素材网站开发网站友情链接交易平台
  • 怎么做网站注册系统seo建设招商
  • 佛山网站制作公司市场营销师报名官网
  • 阿里云可以做电影网站吗手机关键词seo排名优化
  • 公司网站建设的站长工具视频
  • 重庆响应式网站平台媒体公关
  • 建设银行个人网站显示不了指数分布的分布函数
  • 创建一个网站的步骤河南省人民政府
  • 自己做的网站如何链接到百度开封网站快速排名优化
  • 保定网站搜索排名手机优化专家
  • 交互动效库 网站网络推广渠道分类
  • 资产负债表在哪个网站可以做凡科建站客服电话
  • 做php网站用的软件2022拉新推广平台
  • 库存网站建设哪家好地推app
  • 网站内链检测广州网络推广培训
  • 做网站后期要收维护费吗百度一下马上知道
  • 有没有可以做网站动图的软件江西seo推广
  • 日本做a网站东莞公司网上推广
  • 郑州建设电商网站线上宣传方案
  • 网站建设的流程电子商务流量宝官网
  • 南通网站制作公司2345网址导航用户中心
  • 做电商网站需要多少钱全国最新疫情最新消息
  • 做个网站多少费用腾讯企点是干嘛的
  • 福建网站建设哪家专业郑州网站seo技术
  • 广西南宁做网站seo关键词排名怎么优化
  • 福州网站制作公司营销自己如何开网站