Spring Security: accessing Spring beans from your security annotations

This post describes how you can integrate advanced security in your applications using Spring Expression Language and Spring Security.

Combining JPA and Excel to generate testdata for the database

The situation may be all to familiar: you have one or a number of SQL scripts to generate testdata for your database. However, the scripts have a tendency to grow stale quickly whenever the database and model change. Furthermore, the testdata has not been validated by the model and could conceivably be "impossible", such as a status that cannot exist or a value that is stored in the wrong format. The scripts are dragged along during the life of the application and often locally replaced by other solutions, such as in-code Java testdata.

Heeft Java nog toekomst, of gaan andere talen de rol van Java overnemen?

Dit is een interessant verhaal van Steve Vinoski over functionele talen en de manier waarop Java langzaam achter de horizon gaat verdwijnen.

Vooral deze passage:


"Imperative languages such as Java and C++ have come to be known as "high ceremony" languages because of the often mind-numbing amount of syntactic boilerplate and complex object interaction patterns they impose just to get relatively simple applications up and running. Many developers turn to interactive development environments (IDEs) to help them manage this verbosity and complexity, but, in my opinion, this just works around the real problem rather than solves it."


en:


"Using the wrong languages like this can impose a much larger tax on development efficiency than you might realize. Like the proverbial frog in the pot of water on the stove, eventually boiling to its demise as the water temperature slowly increases because it can sense the changes until it's too late, developers who primarily use popular imperative languages like Java and C++ can become so accustomed to the boilerplate, verbosity, and ceremony these languages require that they simply don't realize just how inefficient their development efforts really are. Given how defensive such languages' users can often be, perhaps this form of programming language loyalty is a less sinister variant of Stockholm syndrome, where captives counterintuitively develop a sense of devotion and emotional attachment to their captors."


Prachtig! En ook herkenbaar.


Het is een proces wat zich in alle technologische gebieden voltrekt, maar in de software engineering met een hoge frequentie, omdat gebied zo snel verandert. Software engineers werken met een bepaalde techniek (omgeving, programmeertaal, tool, etc), specialiseren zich daarin, en investeren zichzelf erin. Als er dan iets nieuws of anders langskomt, is de neiging groot om dat als flauwekul, onzinnige nieuwlichterij of zo af te doen. Logisch, begrijpelijk, en meestal nog terecht ook. Want heel vaak zijn die nieuwigheden helemaal niet zo goed, zitten er verborgen nadelen en, en hoe dan ook leveren ze niet de extra productiviteit die het zinnig maakt om van de bekende technologie af te stappen.


Maar van tijd tot tijd moet dat toch gebeuren. Het is duidelijk dat het Web als platform zoveel nieuws heeft gebracht dat een deel van de gangbare tools en talen wel eens aan vervanging toe zou kunnen zijn.


Overigens roept Vinoski's verhaal wel vragen op. Bijvoorbeeld:
Zijn die FPs echt beter? Hoe belangrijk is de relatie met REST in dit verband? Hoe verhoudt OO zich tot dit verhaal?


En is Java echt aan het einde? Zo ja, komt er dan weer een "nieuw Cobol", een taal die min of meer algemeen wordt gebruikt zoals Java nu? En welke zou dat dan zijn?


Een goede reden om eens te kijken naar de mogelijkheden van talen zoals het door Vinoski genoemde Ruby, of Python, of Scala, maar misschien ook wel naar bv het nieuwe Go. Of hebben we zo''n taal niet meer nodig?


Maar dat een andere keer.


(dit verhaal is elders in andere vorm eerder gepubliceerd).

Unit testing Spring beans with mocked dependencies

When overriding dependencies of Spring beans with mock objects, all tests except the first will fail. This blog post explains why and provides a simple solution.