Spring Java Config 101
After my last article there were some questions about how Java configuration work in details, and we can extend it to suite our needs. So I'll try to answer those question in this post :) Heart of Spring java configuration mechanism are @Configuration classes. That's the place where we can define all properties of our Spring context. Assuming that we lean our application on annotations (which should be true if we want to use java config) we create beans using @Component annotation (with derivatives like @Repository , @Service and @Controller ). Varying annotations apply for different layers: @Component generic for any compoenents @Repository persistence layer @Service service layer @Controller presentation layer