Skip to content

Commit

Permalink
Update spring-framework-quiz.md (#3762)
Browse files Browse the repository at this point in the history
New question.
  • Loading branch information
Jhironsel authored Jun 2, 2022
1 parent 4865b1e commit 53e4435
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions spring-framework/spring-framework-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -730,3 +730,66 @@ public Pojo getPojo(@PathVariable("id") String id) {
- [ ] active.spring.profiles
- [x] spring.profiles.active
- [ ] profiles

#### Q71. Which statement is true regarding loading and instantiation of Spring factories?
- [ ] During startup, the SpringFactoryInitializr collects all files in the CONFIG-INF directory from each dependency and downloads binaries to run each file.
- [ ] During startup, the SpringFactoriesLoader gets a list of config and collects all the files in META-INF directory from dependencies. Then it builds a composite list for application context configurations.
- [ ] During shutdown, the SpringFactoryDestructor collects all the files in META-INF directory from each dependency and begins shutting down each thread and process.
- [ ] During startup and shutdown, the SpringFactoryInitializr downloads project configs for all configured dependencies.

#### Q72. What methods does this Pointcut expression reference?
```java
execution(* com.linkedin.TestService.*(..))
```
- [ ] all methods of classes in the com.linkedin.TestService package
- [ ] all methods of classes in the com.linkedin.TestService package annotated whith @Service
- [ ] This Pointcut is not valid.
- [ ] all methods defined by the TestService interface

#### Q73. When configuring an application, which configuration is given precedence by Spring?
- [ ] profile specific application-{profile}.properties files
- [ ] Java System Properties
- [ ] application properties located in an application.properties file inside the application.jar
- [ ] profile specific application-{profile}.properties files located outside the application.jar

#### Q74. What interface is used to represent a permission in Spring Security?
- [ ] GrantedAuthority
- [ ] SecurityChain
- [ ] PermissionMatrix
- [x] AccessRule

#### Q75. What is the difference between constructor injection and setter injection?
- [ ] Constructor injection overrides setter injection.
- [ ] Setter injection creates a new instance if any modification occurs.
- [ ] You can't use constructor injection for partial injection.
- [ ] Constructor injection is more flexible than setter injection.

#### Q76. Which println would you remove to stop this code from throwing a null pointer exception?
```java
@Component
public class Test implements InitializingBean {
@Autowired
ApplicationContext context;
@Autowired
static SimpleDateFormat formatter;

@Override
public void afterPropertiesSet() throws Exception {
System.out.println(context.containsBean("formatter") + " ");
System.out.println(context.getBean("formatter").getClass());
System.out.println(formatter.getClass());
System.out.println(context.getClass());
}
}
@Configuration
class TestConfig {
@Bean
public SimpleDateFormat formatter() {
return new SimpleDateFormat();
}
}
```
- [ ] formatter.getClass()
- [ ] context.containsBean("formatter")
- [ ] context.getBean("formatter").getClass()
- [ ] context.getClass()

0 comments on commit 53e4435

Please sign in to comment.