1. How is the application JVM configured?

The application JVM is configured with the following options:
☛ com.sun.management.jmxremote
☛ com.sun.management.jmxremote.port=1088
☛ com.sun.management.jmxremote.authenticate=false
☛ com.sun.management.jmxremote.ssl=false

2. What are the advantages of setter dependency injection?

Here are a few advantages of Setter:
☛ Natural for Java Beans
☛ Avoids overly long constructors
☛ Can be inherited
☛ Easier to understand in that properties have names
☛ Constructor args don't have names

3. How to access JMX (Java Beans) from a process running in docker container?

You have to expose the JMX port to the host and even used Sun specific options while running the Java process.
You are able to telnet to the host ip and the exposed JMX port, which tells that it is accessible. But I can't figure out a way to use JConsole and connect to the JMX service running in the container.
☛ Djava.rmi.server.hostname=$JMX_HOSTNAME
☛ Dcom.sun.management.jmxremote.port=$JMX_PORT
☛ Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT

4. What are the various actions performed when an application context is created?

Here are 5 steps:
☛ Read bean file XML (or process annotations). Build internal "map" of beans and determine dependency tree.
☛ Post process the definitions - e.g. resolve ${variables}
☛ Allocate objects - dependency inject constructor args and invoke setter.
☛ Perform any initialisation - 3 approachs: @PostConstruct, init-method, InitializingBean
☛ Bean post-processors - e.g. wrap with proxy, @Required

5. What is a named pointcut and why to use one?

A pointcut expression that has a name so it can be reused.
Resons To use:
☛ Annotation: @Pointcut applied to a dummy method - name of the dummy method is the name of the pointcut expression.
☛ XML aop:pointcut id=".." expression=".."

6. List some types of advice?

Types of advice:
☛ Before
☛ AfterReturning
☛ AfterThrowing
☛ After
☛ Around

7. What is an advice in JMX?

he code that implements the cross cutting-concern that will be inserted at each join-point.

8. What is a join-point?

Joint-point is an expression that defines zero or more join-points.

9. What is a cross-cutting concern?

A requirement that cuts across all the natural modules of your application.
Examples:
Tracing, security, transactions, business rules.
Two problems with cross-cutting concerns.
☛ Code tangling - method doing too many unrelated tasks
☛ Code scattering - code duplication leading to maintenance headache

10. What is lazy initialization?

Bean is not allocated until it is actually needed - dependency injected - or requested via getBean(). specify lazy="true" (false by default). Only useful if bean genuinely may never be used in most runs of the application.

Download Interview PDF