User Login

Please enter user name and password into following boxes!

If you are not registered yet, please click

Forget Password

If you forget your password, please click

spring

  • Spring Security Concurrent Session Implementation With Custom Form Login Filter

    In Spring 4, we can use following configuration to adjust concurrent session count: To use concurrent session support, you’ll need to add the following to web.xml: <listener> <listener-class> org.springframework.security.web.session.HttpSessionEventPublisher </listener-class> </listener> In addition, you will need to add the ConcurrentSessionFilter to your FilterChainProxy. The ConcurrentSessionFilter requires two properties, sessionRegistry, which generally points to an instance of SessionRegistryImpl, and expiredUrl, wh...Continue Reading

    Abstract classes and Spring MVC @ModelAttribute/@RequestParam

    You need to provide your own Binding methods and then create the correct subtypes. Spring wouldn't know otherwise which of the subtypes should be instantiated for which element. Example: Url address can be like this: /proje-basvuru/ilk-uzun-metrajli-film or /proje-basvuru/kisa-film @ModelAttribute("project") public Project getProject(final HttpServletRequest request){ return createProject(getProjeBasvuruUrl(request.getRequestURI())); } private Project createProject(String projectType) { if (projectType.equals("ilk-uzun-metrajli-film")) r...Continue Reading

    JUnit 4 Testing with DBUnit in Spring Hibernate Application

    HsqlDb Connection 1. Download hsqldb.zip file from here 2. Extract zip file 3. Open bin folder in the hsqldb folder 4. Edit runServer.bat file as follows: cd ..\data @java -classpath ../lib/hsqldb.jar org.hsqldb.server.Server -database.0 mem:sample -dbname.0 sample 5. Save and run runServer.bat file 6. After running this file you should see the command prompt as follows: Spring applicationContext-test.xml File <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"...Continue Reading

    AspectJ Load Time Weaving in Spring

    Aspect-Oriented Programming (AOP) complements Object-Oriented Programming (OOP) by providing another way of thinking about program structure. The key unit of modularity in OOP is the class, whereas in AOP the unit of modularity is the aspect. Aspects enable the modularization of concerns such as transaction management that cut across multiple types and objects. (Such concerns are often termed crosscutting concerns in AOP literature.) Lets start how to configure load time weaving in Spring framework. applicationContext.xml Configuration <bean id=...Continue Reading

    Spring Security in JUnit Test

    @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/applicationContext.xml", "classpath:/mvc-dispatcher-servlet.xml", "classpath:/spring-security.xml"}) @WebAppConfiguration public class UserControllerTest { @Autowired private UserService userService; @Autowired WebApplicationContext wac; private MockMvc mockMvc; @Before public void setup() { MockitoAnnotations.initMocks(this); this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).apply(springSecurity()).bui...Continue Reading

    Spring Security Testing With JUnit

    Maven Dependencies <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.12</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>4.1.4.RELEASE</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <version>4.0.0.RELEASE</v...Continue Reading

    Spring MVC JUnit And Mockito Configuration

    @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:/applicationContext.xml", "classpath:/mvc-dispatcher-servlet.xml", "classpath:/spring-security.xml"}) @WebAppConfiguration public class GumrukServiceUtilTest { @Autowired WebApplicationContext wac; @Autowired private UserService userService; private MockMvc mockMvc; @Before public void setup(){ MockitoAnnotations.initMocks(this); this.mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();...Continue Reading

    Spring MVC JUnit Mock Standalone Configuration

    Maven Dependencies <properties> <spring.test>4.1.4.RELEASE</spring.test> <junit.version>4.12</junit.version> <hamcrest.version>1.3</hamcrest.version> <mockito.all>2.0.2-beta</mockito.all> </properties> <dependencies> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.test}</version> <scope>test</scope> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactI...Continue Reading