Home » Tag Archives: Spring (page 45)

Tag Archives: Spring

JMX and Spring – Part 1

spring-interview-questions-answers

This is the first of three articles which will show how to empower your Spring applications with JMX support. Maven Configuration This is the Maven pom.xml to setup the code for this example:           <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>uk.co.jemos.experiments.jmx</groupId> <artifactId>jemos-jmx-experiments</artifactId> <version>0.0.1-SNAPSHOT</version> <name>jemos-jmx-experiments</name> <description>Jemos JMX Experiments</description> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <source>1.6</source> <target>1.6</target> ...

Read More »

JMX and Spring – Part 3

spring-interview-questions-answers

This article is the last one of this series. Take a look at Part 1 and Part 2. In this last article of the series I’ll show how to use the native JMX support within the JDK to implement a notification mechanism which alerts a listener when the HEAP memory is above a certain threshold. As discussed in my previous ...

Read More »

JMX and Spring – Part 2

spring-interview-questions-answers

This post continues from Part 1 of the tutorial. Hi, in my previous article I explained how to setup a JMX server through Spring and how to protect access to it through authentication and authorisation. In this article I will show how to implement a simple MBean which allows users to change the level of a Log4j logger at runtime ...

Read More »

Spring Custom Namespaces

spring-interview-questions-answers

Spring Custom Namespaces provides a good way to simplify the xml files used to describe the bean definitions of a Spring Application Context. It is a fairly old concept, first introduced with Spring 2.0, but deserves being reviewed once in a while. Consider a case of having to configure a part of the beans for a Spring MVC application without ...

Read More »

Spring Security Part 1 – Simple Login application with database

spring-security-logo

What is Spring Security? Spring security is a framework that provides security solution, handling authentication and authorization at both the web request level and the method level. Spring security handle security in two ways. One is secure web request and other one is restrict access at the URL level. Spring security uses servlet filters. In this post I’m going to ...

Read More »

REST + Spring Security session problem

spring-security-logo

REST, sessions .. wait. There are no sessions in REST application, right? Well, thats true. If we can avoid sessions we should do that. REST is stateless. The main concern about statelessness is authentication. In usual web applications we were used to store user data in session after authentication. How to solve that if we don’t want to use sessions? ...

Read More »

Spring MVC Integration Tests

spring-interview-questions-answers

An approach to Integration Testing the controllers in Spring MVC is to use the Integration Test support provided by Spring. With Junit4 this support consists of a custom Junit Runner called the SpringJunit4ClassRunner, and a custom annotation to load up the relevant Spring configuration. A sample Integration test would be along these lines: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:/META-INF/spring/webmvc-config.xml", "contextcontrollertest.xml"}) public class ContextControllerTest { ...

Read More »

Spring & JSF integration: Exception Handling

jsf-logo

Most JSF developers will be familiar the “An Error Occurred” page that gets displayed when an unexpected exception is thrown somewhere their code. This page is really useful when developing but is not something you usually want for a production application. You generally have a couple of options when it comes to replacing this page with stock JSF; you can ...

Read More »

Spring 3.1 profiles and Tomcat configuration

spring-interview-questions-answers

Spring 3.1 introduced very useful feature called profiles. Thanks to that its easy to build one package that can be deployed in all environments (development, test, production and so on). By defining system property spring.profiles.active Spring allows us to create different beans depending on active profile name using XML configuration or @Profile annotation. As we all know system properties can ...

Read More »

Concurrency – Executors and Spring Integration

spring-interview-questions-answers

Thread Pool/Executors Based Implementation A better approach than the raw thread version, is a Thread pool based one, where an appropriate thread pool size is defined based on the system where the task is running – Number of CPU’s/(1-Blocking Coefficient of Task). Venkat Subramaniams book has more details: First I defined a custom task to generate the Report Part, given ...

Read More »
Want to take your Java Skills to the next level?
Grab our programming books for FREE!
  • Save time by leveraging our field-tested solutions to common problems.
  • The books cover a wide range of topics, from JPA and JUnit, to JMeter and Android.
  • Each book comes as a standalone guide (with source code provided), so that you use it as reference.
Last Step ...

Where should we send the free eBooks?

Good Work!
To download the books, please verify your email address by following the instructions found on the email we just sent you.