[Spring] Simple Example with @Value and annotation driven configuration (no xml)

This is an example of a simple maven Spring application run as a standalone application which demonstrates the use of properties files and annotation based configuration. 1. The Configuration Bean. Here are 2 important things: You need to provide basePackages to the package where your applicaiton resides. In particular, where you MainClass resides. You need…

[SOLVED] Spring Security allow webjars through

So if you implemented Spring Security in your project, you might have problems with webjars not being allowed through. You need to set this configuration in your WebSecurityConfiguration:   [code language=”java”] @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/webjars/**").permitAll(); http.authorizeRequests().anyRequest().authenticated(); http.formLogin() .loginPage("/login") .failureUrl("/login?error") .usernameParameter("email") .permitAll() .and() .logout() .logoutUrl("/logout") .deleteCookies("remember-me") .logoutSuccessUrl("/") .permitAll() .and() .rememberMe(); }…

[STARTER] Spring + AOP (Aspect Oriented Programming)

1. The Performance interface

2. The actual Aspect

3. RockPerfomance

4. Beans Configuration

5. Main class

6. pom.xml

7. Layout

[Starter] Spring Runtime autowiring (Implicit bean discovery) – non boot

Here is a starter for a Spring 4 + Maven application that makes use of implicit bean discovery and loads some data from a properties file: 1. The bean. Make sure to: create a default constructor. add the @Component annotation denoting that it will be a bean [code language=”java”] package com.vvirlan.spring.examples; import org.springframework.stereotype.Component; @Component public…