Archive for the ‘spring’ Category

« Older Entries

Modular development with OSGI about to be very, very popular – finally.

Posted in: J2EE, JPA, OSGI, System architecture, eclipselink, java, open source, spring.

It’s quite exciting to see the tremendous progress in development tools, patterns, frameworks and libraries since the release of JAVA 1.0 in 1996.
Within just thirteen years, development improved from the first applets, from the dark ages of the first EJB standardization attempts and a lack of suitable development processes into an age where aspect oriented programming, dependency injection and a freely available range of lightweight yet extremely powerful frameworks, libraries and API’s finally permitted the humble programmer to do what he always wanted to do – analyze problems, and elegantly write them down without spending all of his precious time on the syntax.

I would even go as far as saying that there was no object orientation before programming crosscutting concerns and using dependency injection became established mechanisms.
Think about it: The original goal of OO is not to use inheritance, encapsulation, identity and polymorphism, but to express the real world of things – our reality – using an abstract world of things, while preserving most of the properties and relationships we observe in reality.

Before AOP, before being able to separate the description of things from creating, configurating and connecting concrete instances through dependency injection frameworks, this goal was hard to achieve.

Modules larger than classes with OSGI

Now however, we are about to reach a new stage in development of object orientation in JAVA: Developing modules that are larger than classes, modules which can, once properly identified, be developed independently using all the wonderful technology described beforehand. The technology used to achieve this has a name: OSGI. This technology has quite a long history of development, but a certain lack of elegance and light-weightiness barred this component model from becoming a real hit in the worldwide development community. This is about to change.
Read the rest of “Modular development with OSGI about to be very, very popular – finally.”

No Comments

Maven, Surefire, remote debugging and the -javaagent switch

Posted in: J2EE, java, maven 2, spring.

When using maven surefire in conjunction with remote debugging (mvnDebug, for instance)
it seems necessary to disable forking of the test executions into separate processes, as the remote debugging works process wise. This is usually done by setting the the fork mode to never, e.g. by specifying -DforkMode=never on the command line.

This is, however, a misunderstanding. mvnDebug is there to enable debugging of the maven process and not of the surefire execution – and disabling forking may have various side effects. One of those is the use of Java agents. When using agents, e.g. for loadtime-weaving in the Spring Framework, one often specifies a -javaagent: as a JVM argument for surefire:
Read the rest of “Maven, Surefire, remote debugging and the -javaagent switch”

1 Comment

Howto use acegi-security and the @Secured annotation for method interception

Posted in: J2EE, System architecture, acegi, java, spring.

Acegi-security (now spring-security) provides a @Secured (org.acegisecurity.annotation.Secured) annotation.
Classes using this annotation can be processed by a suitable BeanPostProcessor, which will proxy the class so that calls to @Secured methods are intercepted and the required authentication is validated against the acegi security context. Note that the following is a configuration for acegi-security, things might be different with spring-security.

2008-07-12: Comment: It is indeed a lot simpler using spring-security, as Craig Walls demonstrates in this posting in his blog “Spring-Loaded”).

In order to activate the post processing for the @Secured annotations, a spring configuration such as the following is required:
Read the rest of “Howto use acegi-security and the @Secured annotation for method interception”

No Comments

Why it’s better to integrate XML schema files into the classpath

Posted in: J2EE, System architecture, java, spring.

When using schema files in your XML configuration, it’s might happen that your XML parser will attempt to actually download the schema file using the configured schema URI.
This is the case when there is no mechanism for resolving the schema URI to a local schema file (as, for example the bean handler registration in spring) or when such a mechanism fails.
Read the rest of “Why it’s better to integrate XML schema files into the classpath”

No Comments

Internationalisierung mit Spring

Posted in: java, spring.

Das spring framework bietet eine Reihe mächtiger, aber einfach zu verwendenden Mechanismen für Internationalisierung.
In diesem Blog wird eine recht gute Einführung mit Codebeispielen gegeben.

No Comments

Why @Configurable and @Transactional don’t belong to into the same class

Posted in: J2EE, JPA, System architecture, java, spring.

When using the Spring framework, one can still benefit from dependency injection etc. even if a bean is not obtained from a bean factory by using the @Configurable annotation, f.e.:
Read the rest of “Why @Configurable and @Transactional don’t belong to into the same class”

5 Comments

Spring tools für eclipse

Posted in: J2EE, eclipse, java, spring.

Wer mit dem spring framework entwickelt sollte das spring IDE Projekt nicht missen.
Die einfach zu installierenden Plugins erweitern unter anderem den XML-Editor um nützliche “content assists” für die spring Konfiguration.

spring ide im XML Editor von Eclipse

Sehr nützlich!

No Comments

Spring-loaded

Posted in: J2EE, System architecture, java, spring.

Craig Walls, einer der Autoren des famosen “Spring in action” Buches, schreibt in seinem Weblog vieles extrem Lesenswertes rund um Spring. Dank der zahlreichen Codebeispiele eine gute Quelle für best practice Spring – und natürlich sehr aktuell!

No Comments

Spring context, überall – auch mit openAMF

Posted in: J2EE, System architecture, java, spring, tomcat.

Benutzt man zur Anbindung eines Flash-Frontends openAMF oder macht man irgend etwas Ähnliches, was am DispatcherServlet vorbei geht, muss man nicht auf die AOP basierten scopes verzichten. In diesem Fall stellt ein einfacher Filter in der web.xml die entsprechenden Scopes ur Verfügung:

    <filter>
        <filter-name>springContextFilter</filter-name>
        <filter-class>org.springframework.web.filter.RequestContextFilter</filter-class>
    </filter>

    <filter-mapping>
        <filter-name>springContextFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

Mehr dazu gibt’s natürlich in der spring-doku!

No Comments

Spring-Konfiguration mit XML-imports

Posted in: J2EE, System architecture, java, spring.

Statt den Spring-Context mit einer ganzen Menge von .xml-Ressourcen zu konfigurieren Kann man diese auch per import in eine Spring-Konfiguration includen.
eine Spring-context.xml kann zum Beispiel so aussehen:

< ?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
       ...
       <import resource="eineWeitereKonfiguration.xml"/>
       ..
</beans>

Read the rest of “Spring-Konfiguration mit XML-imports”

No Comments « Older Entries