ExtJS is a product by Sencha. They provide 2 licenses. 1. Commercial and 2. GPL. For your own learning you can download the free version with GPL license from below link.
ExtJS Download
Monday, February 19, 2018
Friday, February 16, 2018
How to keep a thread running in java?
To elaborate more on this question, there are situations in your application where you have a java service which keeps on polling for something like a table and based on some condition it will invoke some business api or methods. However, to keep this thread running what techniques can be used.
Post your replies in comments section and I will add the answer here whichever sounds more appropriate.
Post your replies in comments section and I will add the answer here whichever sounds more appropriate.
Spring Interview Questions and Answers
What is difference between @RestController and @Controller?
@Controller
is used to mark classes as Spring MVC Controller.
@RestController
is a convenience annotation that does nothing more than adding the @Controller
and @ResponseBody
annotations
So the following two controller definitions should do the same
@Controller
@ResponseBody
public class MyController { }
@RestController
public class MyRestController { }
@Controller
is used to mark classes as Spring MVC Controller.@RestController
is a convenience annotation that does nothing more than adding the @Controller
and @ResponseBody
annotations
So the following two controller definitions should do the same
@Controller
@ResponseBody
public class MyController { }
@RestController
public class MyRestController { }
Which Spring Modules have you worked on?
Some mostly used spring modules are,
- Spring MVC
- Spring AOP
- Spring Security
- Spring JDBC
- Spring Core
- Spring Web-MVC
- Spring Boot
You may refer spring.io for more details of each module.
What benefits spring JDBC provides over jdbc?
The JDBC abstraction framework provided by Spring consists of four different packages:
- The
core
package contains theJdbcTemplate
. This class is one of the fundamental classes provided by and used by the Spring framework's JDBC support. - The
datasource
package is a great fit for unit testing database access code. ItsDriverManagerDataSource
can be used in a way that is similar to what you are already used to from JDBC: just create a newDriverManagerDataSource
and call the setter methods to setDriverClassName
,Url
,Username
, andPassword
. - The
object
package contains classes that represent RDBMS queries, updates, and stored procedures as thread safe, reusable objects. - The
support
package is where you can find theSQLException
translation functionality and utility classes.
The Template Design Pattern
Spring JDBC implements the Template design pattern, meaning the repetitive plumbing parts of the code are implemented in template classes. This approach simplifies the use of JDBC, since it handles the creation and release of resources. This helps to avoid common errors like forgetting to close the connection. It executes the core JDBC workflow tasks like statement creation and execution, leaving application code to provide SQL and extract results.
Spring JDBC Exception Handling
The Spring framework addresses the problems faced in traditional JDBC programming with the following solutions:
- Spring provides an abstract exception layer, moving verbose and error-prone exception handling out of application code into the framework. The framework takes care of all exception handling; application code can concentrate on extracting results by using appropriate SQL.
- Spring provides a significant exception hierarchy for your application code to work with in place of
SQLException
.
With the help of an abstract exception layer, we achieve database independence without having to change the exception handling. For example, if you change your database from PostgreSQL to Oracle, you do not have to change the exception handling from OracleDataException
to PostgresDataException
. Spring catches the application-server-specific Exception
and throws a Spring data exception.
When dealing with exceptions, Spring examines the metadata available from a database connection to determine the database product. It uses this knowledge to map SQLException
to the correct exception in its own hierarchy. So, we need not worry about proprietary SQL state or error codes; Spring's data access exceptions are not JDBC-specific, so your DAOs are not necessarily tied to JDBC because of the exceptions they may throw.
SQLException
.OracleDataException
to PostgresDataException
. Spring catches the application-server-specific Exception
and throws a Spring data exception.SQLException
to the correct exception in its own hierarchy. So, we need not worry about proprietary SQL state or error codes; Spring's data access exceptions are not JDBC-specific, so your DAOs are not necessarily tied to JDBC because of the exceptions they may throw.What is Spring MVC and how it is useful?
Model - holds data eg. Bean
View - Contains view code like JSP, HTML page.
Controller - Controller holds business logic. Binds View and Models together.
Mainly MVC allows different components to be modified with no or very less side effects.
What features does spring boot provide?
- convention over configuration, get you up and running quickly, stand-alone production grade apps
- Create stand-alone Spring applications
- Embed Tomcat, Jetty or Undertow directly (no need to deploy WAR files)
- Provide opinionated 'starter' POMs to simplify your Maven configuration
- Automatically configure Spring whenever possible
- Provide production-ready features such as metrics, health checks and externalized configuration
- Absolutely no code generation and no requirement for XML configuration
What is an aspect?
Aspect: a modularization of a concern that cuts across multiple classes. Transaction management is a good example of a crosscutting concern in J2EE applications. Any class can be an aspect.
Declaring an aspect
With the @AspectJ support enabled, any bean defined in your application context with a class that is an @AspectJ aspect (has the @Aspect annotation) will be automatically detected by Spring and used to configure Spring AOP. The following example shows the minimal definition required for a not-very-useful aspect:
A regular bean definition in the application context, pointing to a bean class that has the @Aspect annotation:
<bean id="myAspect" class="org.xyz.NotVeryUsefulAspect">
<!-- configure properties of aspect here as normal -->
</bean>
And the NotVeryUsefulAspect class definition, annotated with org.aspectj.lang.annotation.Aspect annotation;
package org.xyz;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class NotVeryUsefulAspect {
}
Subscribe to:
Posts (Atom)
Calculating Server Capacity: A Comprehensive Tutorial
In this tutorial we will explore the process of calculating server capacity. Let's get started. Understanding Server Capacity Identifyi...