Tag: java

  • @Autowired and @Resource in Spring

    The @Autowired annotation is used to configure the dependency injection in Spring and is associated with a setter method, or a field or a constructor of a class. In the case of a setter method or a field the bean used for dependency injection is chosen depending on the type.

  • Passing information about UI objects to a java agent

    The lotus java agents don’t have classes to manage the UI objects, such as in LotusScript with the classes NotesUIDocument or NotesUIView. It’s true that you can find several info about the Notes Client Java UI API in internet, but these classes are not officially supported. In this post I explain 3 ways to obtain…

  • PropertyEditors in Spring 3

    PropertyEditor is an interface that provides a support for the conversion of the value of a property (usually of type String) in an object that can be Date, URL, etc.

  • Executing code on the creation or destruction of a bean in Spring

    There are 3 ways to execute code to create a bean in Spring: with the annotation @PostConstruct implementing the interface InitializingBean configuring the property init-method The reason why you run code when you create a bean is often to check the dependencies, and assign a default value, or automated actions such as starting a scheduled…

  • The Comparator interface

    In the previous post about the Comparable interface I explained how you can extend a class of objects that implement the Comparable interface and then order them in a list according to the logic defined in the overridden method compareTo. If you want to be able to sort the list according to a number of…

  • The Comparable interface

    A List contains objects that you can order according to a natural order using the static method Collections.sort(List list) if the objects implement the Comparable interface.

  • Basic configuration of Spring Security 3 and MySQL

    In this post I explain how to implement Spring Security in a web application, as I did in a previous post but the authenticated user’s username and password are not saved to a file .xml but in a MySQL database. As in the previous post, I configure one user only trying to access index.html and…

  • Basic configuration of Spring Security 3

    In this post I write about a basic configuration of Spring Security 3, the Spring framework for authentication and authorization of the users. In this example there is only one user trying to access to index.html and he is redirected to the standard login page for authentication. In this project I use and configure maven…

  • How to access to the members of outer class from inner class

    You can’t access to the members of an outer class from an inner class using the keyword “this”. In fact, the keyword “this” in an inner class is a reference to the inner class itself. To have a reference to the outer class, you must use the syntax: [OuterClassName].this where [OuterClassName] is the name of…

  • The android.os.NetworkOnMainThreadException exception

    In this article I explain a possible cause of android.os.NetworkOnMainThreadException and how to avoid it. From the Android site you can read: NetworkOnMainThreadException The exception that is thrown when an application attempts to perform a networking operation on its main thread. This is only thrown for applications targeting the Honeycomb SDK or higher…