Spring Task Example

Reading Time: 1 minute pom.xml [code] <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>com.tugrulaslan</groupId> <artifactId>SpringScheduledTaskExample</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>SpringScheduledTaskExample</name> <url>http://maven.apache.org</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring.version>3.1.2.RELEASE</spring.version> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> </dependencies> </project> [/code] batch.xml in src>java>resources [code] <?xml version=”1.0″ encoding=”UTF-8″?> <beans xmlns=”http://www.springframework.org/schema/beans” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:context=”http://www.springframework.org/schema/context” xmlns:task=”http://www.springframework.org/schema/task” xsi:schemaLocation=”http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/task

Spring Batch Cronjob Expression Dilemma

Reading Time: 1 minute In one of the projects that I’ve assigned to has given me the trouble of synchronization of batches to carry all data from one location to another remote location. The story is that we have a few of batches some of them scheduled to be launched every two minutes or 2 hours, but we’ve come

Enabling auto reconnect in mysql hibernate spring

Reading Time: 1 minute in your spring config file append the url entry with the below sample   <bean id=”dataSource” class=”org.apache.commons.dbcp.BasicDataSource” destroy-method=”close”> <property name=”driverClassName” value=”${database.driverClassName}” /> <property name=”url” value=”${database.url}?characterEncoding=UTF-8&amp;autoReconnect=true”/> <property name=”username” value=”${database.user}” /> <property name=”password” value=”${database.password}” /> </bean>

Spring ZKoss Customized Login, Logout, Authorization and Authentication

Reading Time: 2 minutes CustomAuthenticationFilter.java public class CustomAuthenticationFilter extends UsernamePasswordAuthenticationFilter { @Autowired private xxService xService; static final Logger logger = Logger.getLogger(CustomAuthenticationFilter.class); @Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { String username = request.getParameter(getUsernameParameter()); String password = request.getParameter(getPasswordParameter()); String server = request.getParameter(“server”); if(username.trim().length() == 0 || password.trim().length() == 0){ logger.error(“Error empty credentials entered ” + username + password

Switching Between Hibernate’s and Spring’s Transaction

Reading Time: 1 minute Uncomment the below lines to hand the activation down to Spring pom.xml <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/maven-v4_0_0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>com.tugrulaslan</groupId> <artifactId>WebApp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <name>BlogWebApp Maven Webapp</name> <url>http://maven.apache.org</url> <properties> <project-java.version>1.7</project-java.version> <maven-compiler-plugin.version>3.1</maven-compiler-plugin.version> <junit.version>4.11</junit.version> <mysql-connector.version>5.1.34</mysql-connector.version> <hibernate.version>4.3.8.Final</hibernate.version> <javax-persistance-api.version>1.0.2</javax-persistance-api.version> <spring.version>4.0.6.RELEASE</spring.version> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql-connector.version}</version> </dependency> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>${hibernate.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>${spring.version}</version>

Spring MVC Form Example

Reading Time: 3 minutes In this tutorial I will show you how to create a simple form using Spring 3 MVC Web framework. I have checked other examples regarding creation of forms in Spring MVC Framework, there are many ways of achieving it. With the simplicity  of Spring MVC version 3, we are easing our forms to be implemented

Listing Active Directory users Spring LDAP

Reading Time: 3 minutes Hi in this tutorial I will show you how to connect and retrieve user details on windows active directory server. So previously I have posted how to setup an active directory server on windows server 2008 enterprise edition One by one i will give you the codes and find the full project on github. So let