Home » Tag Archives: Spring (page 29)

Tag Archives: Spring

69 个Spring 面试问题和答案 – 终极列表 (PDF 下载)

spring-interview-questions-answers

这篇文章是关于Spring框架的一些最重要问题的总结,在面试或笔试过程中可能被问到! 不用担心您的下一个面试的的测试,因为Java Code Geeks会为您服务!您可能被问到的大部分问题都列在了这里。所有的核心模块, 从基础的Spring功能例如Spring Beans到 Spring MVC 框架都被列在了这里而且简单的介绍了。在查看了这些面试问题后,您可以查看我们的 Spring教程页面。那么,我们开始吧…! 提示:您在寻找java方面的工作机会吗?访问我们的工作面板  来搜索和查看精心选择的为全世界的IT专业人士准备的Java工作。另外,您也可以把您的简历添加到我们的  简历面板来提高您的技能来使全世界的Java招聘者看到您。 目录 Spring 概述 依赖注入 Spring Beans Spring 注解 Spring 数据访问 Spring 面向方面编程 (AOP) Spring 模型视图控制器 (MVC) Spring 概述 1. Spring是什么? Spring是针对企业版 Java的开源的开发框架 。Spring框架的核心功能能被用于开发任何的Java程序,但有针对基于Java EE平台上的Web应用程序的扩展。Spring框架的目标是使JavaEE的开发更加容易并通过使用基于POJO的编程模型来促进编程最佳实践的应用。 2. Spring 框架有什么优势? 轻量级: 在尺寸和透明度方面Spring 是轻量级的。spring框架的基础版本只有大约 2MB 大小。 控制反转 (IOC): 通过控制反转技术 ,Spring实现了松耦合。对象间只是给出了依赖性,而不是创建或寻找依赖对象。 面向切面 (AOP): Spring 支持面向切面编程 而且把应用的业务逻辑从系统服务分离开了。 容器: Spring 包含并管理应用对象的生命周期和配置。 MVC 框架: Spring的 web 框架是一个设计良好的 web MVC 框架, 它可以作为其他web框架的替代。 事务管理: Spring ...

Read More »

Improving performance: non-blocking processing of streams

spring-interview-questions-answers

1. Introduction Imagine we have an application that needs to access an external web service in order to gather information about clients and then process it. More specifically, we can’t get all this information in a single invocation. If we want to look up different clients, we will need several invocations. As shown in the graphic below, the example application ...

Read More »

Spring Boot Integration Testing with Selenium

Web integration tests allow integration testing of Spring Boot application without any mocking. By using @WebIntegrationTest and @SpringApplicationConfiguration we can create tests that loads the application and listen on normal ports. This small addition to Spring Boot makes much easier to create integration tests with Selenium WebDriver. Test Dependencies The application that we will be testing is a simple Spring ...

Read More »

Introduction to Spring profiles

spring-interview-questions-answers

So many men, so many minds. When we are implementing software for different customers we sometimes need to handle various requirements for the same project. For example Customer A needs SAML authentication and customer B needs LDAP authentication. With Spring Profiles (available from Spring 3.1) we are able to provide a way to segregate parts of our implemented application configuration. ...

Read More »

Using Spring managed Bean in non-managed object

spring-interview-questions-answers

We have to deal with legacy code, even when we would like to use the best and newest technologies available. Imagine the new code is written with the newest technologies of the Spring Framework and the legacy code is not written in Spring at all. Then using Spring managed Beans in non-managed Spring objects is one of the patterns we ...

Read More »

Netflix Archaius properties in a Spring project

spring-interview-questions-answers

Archaius Basics Netflix Archaius is a library for managing configuration for an application. Consider a properties file “sample.properties” holding a property called “myprop”:               myprop=myprop_value_default This is how the file is loaded up using Archaius: ConfigurationManager .loadCascadedPropertiesFromResources("sample"); String myProp = DynamicPropertyFactory.getInstance().getStringProperty("myprop", "NOT FOUND").get(); assertThat(myProp, equalTo("myprop_value_default")); Archaius can load property appropriate to an environment, consider ...

Read More »

Integration testing on REST urls with Spring Boot

spring-interview-questions-answers

We are building a Spring Boot application with a REST interface and at some point we wanted to test our REST interface, and if possible, integrate this testing with our regular unit tests. One way of doing this, would be to @Autowire our REST controllers and call our endpoints using that. However, this won’t give full converage, since it will ...

Read More »

Java Bootstrap: Dropwizard vs. Spring Boot

spring-interview-questions-answers

How to get a production ready Java application off the ground in the shortest time possible? I’m not a morning person, so sometimes it takes a while for the “all systems are go” cue to kick in. This used to be true for Java applications until not too long ago, but unlike the invention of the snooze function on the ...

Read More »