Spring security is designed to provide both authentication and authorization to Java applications. This article mainly try to describe spring security from a general concept view, give you a whole picture of how the spring security works in most usage. Other articles are: Understand spring security easily – developer view (to be continued) Understand spring security easily – annotation example...
Wednesday, December 30, 2015
Tuesday, December 29, 2015
"Config method" in Spring framework
1. Concept What is config method in Spring? Any method that is anotated by @autowired is config method. What’s the difference between a normal method and a config method in spring? Config method will be automatically invoked when the bean instance created, after constructor but before @PostConstruct. The parameters of config method will be autowired from the application context. The...
Wednesday, December 23, 2015
Break down package java.util.concurrent.locks
Since JDK 5, Java introduced the most powerful enhancement for concurrence, the package java.util.concurrent.This package contain 2 subpackages, one of them is java.util.concurrent.locks, which provides the notion of locks for synchorization. (BTW, the other subpackage is java.util.concurrent.atomic,...
Wednesday, December 16, 2015
Use Spring Test without @RunWith(SpringJUnit4ClassRunner.class)
This is a new feature from Spring framework 4.2. Now you can use other JUnit's runners,like Parameterized or MockitoJUnitRunner but without losing spring test benefits. (with all the features you love with spring-test like spring Dependency Injection , Auto-rollback Transaction for test and etc)....
Wednesday, December 9, 2015
Most used Hibernate properties during development
Hibernate has many properties that can be very helpful during development phrase. In this article we list some most used hibernate properties used when developing/testing persistence layer applications. 1. Meaning of most used hibernate properties 1.1 Print out Hibernate created SQL hibernate.show_sql = true 1.2 Automatic create tables according to entities hibernate.hbm2ddl.auto = create...
Tuesday, December 1, 2015
Remote Debug in Eclipse
Remote debug a Java application means the application run on a different VM rather than the one used for Eclipse. The Java application can run on the same host of you Eclipse as a separate process or on remote host. In practical remote debug happens when there are some external environments in production...
Monday, November 30, 2015
Understand Persistence Context Collision in JEE
When deal with persistence layer in JEE application, persistence context is the magic that make your entity instances different from a normal POJO. Persistence context manages the entity instances to make it finally synchronized with database. The persistence context collision happens when invoking...
Monday, November 23, 2015
How to setup a maven JEE project in Eclipse
Let's suppose you are new to JEE programming. After reading oracle official JEE tutorial document for a few days, you decide to get your hands wet. You download and install a JEE container, GlassFish 4 in this tutorial, to your PC. You have JDK,maven and Eclipse all ready. So, what's...
Sunday, November 15, 2015
Low-level synchronization in Java
Low level synchronization is the mechanism used before package java.util.concurrent was introduced into Java 1.5. You may not use it since the modern Java provide more high level sync mechanism since Java 1.5, but understand low-level sync can help you understand high-level counterparts like java.util.concurrent.locks.Condition,...
Thursday, November 12, 2015
Understand Glassfish JDBC configuration by inspecting JDBC DataSource API
When configure DataSource on JEE container Glassfish, There are 2 things need to be set, JDBC Resource and JDBC Connection Pools. What's the difference and why are these two items? What's the relation between them? We can answer that by inspecting the Java JDBC API, mainly in package javax.sql 1. How...
Tuesday, November 10, 2015
Break down class "Files" of java 7 NIO.2
Since Java 7, File related IO operation has been redesigned. The following 3 classes/interfaces are key for file related operations: Path,Paths, and Files. They are all in package java.nio.file. Among all these 3, Files is the most fundamental one. 0. Brief about Path and Paths Paths is a concrete classes...
How to understand < ? super Child> in Java Generics
In Java, polymorphism does NOT apply to generic types. So suppose class Child extends from class Parent, then the following 2 lines, only the first can pass compilation. Parent var = new Child(); // compiler is happy with this ArrayList<Parent> myList = new ArrayList<Child>(); // compilation errorThe way to bring the idea of inheritance into Java generic types is using <? extends...
Monday, November 9, 2015
How to understand < ? extends Parent> in Java Generics
In Java, polymorphism does NOT apply to generic types. So suppose class Child extends from class Parent, then the following 2 lines, only the first can pass compilation. Parent var = new Child(); // compiler is happy with this ArrayList<Parent> myList = new ArrayList<Child>(); // compilation errorThe way to bring the idea of inheritance into Java generic types is using <? extends...
Thursday, November 5, 2015
Glob in Java file related match
Globs are not regular expression. Glob is simpler and earlier than regular expression. For historical reasons, glob are more used as file name or file path filtering. In Java 7 NIO package has 2 places that glob appears as file names or file path filter. One is when you create a PathMatcher to test if a java.nio.file.Path instance matches a patten likePath path = Paths.get("abc.java");PathMatcher...
Tuesday, November 3, 2015
A brief in Java string format
When to format a Java String using System.out.printf or System.out.format, The syntax for the format is : %[arg_index$][flags][width][.precision]<conversion_char>Here are more explanation:arg_index An integer with suffix '$'. begin with 1, not 0. The position of the args. flags - Left-align, default is right-aligned + Include +/-before number 0 Pad with zeros before number...
Friday, October 30, 2015
How to use embedded Java DB (Derby) in maven project
For now, Java DB is actually just Apache Derby with a different name. In the following of the article, we will call it Derby. It comes with JDK installation. ( Although what's normally used in maven project is not the same binary install in local JDK directory) Using embedded Java DB means...
Subscribe to:
Posts (Atom)
Powered by Blogger.
About The Author

View my complete profile