This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring in Action - other programming languages?

 
Piotr Kalinowski
Greenhorn
Posts: 6
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Author,

In a sample chapter of your book one can read that it is possible to reduce XML size by using annotations or Java-based configuration. My question is: what about other languages, especially those running on JVM? Is it possible to configure Spring with such languages, e.g. Groovy? Is it possible to completely replace XML with some scripting language? Do you think it would be a good idea, or just an alternative for "XML-haters"?

Thanks,
Piotr
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can certainly replace XML or JavaConfig with Groovy. In fact, that's what the Groovy configuration stuff from Grails does. I've also seen other similar efforts to configure Spring in other languages, including one awhile back called Springy that let you configure it in Ruby.

I don't cover those in the book, though. Even so, they're great configuration options to consider. I especially like the Groovy configuration stuff. Configuring in Java or Groovy (or any other language) rather than XML buys you a lot of benefits, including less of a dependence on string identifiers, more type safety, testability of the configuration themselves, and the ability to write intelligent configuration (configuration that takes advantage of language constructs to do more than just simply create objects and set properties...make decisions, loop, etc).
 
Joe Harry
Ranch Hand
Posts: 10124
3
Eclipse IDE Mac PPC Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig Walls wrote:You can certainly replace XML or JavaConfig with Groovy. In fact, that's what the Groovy configuration stuff from Grails does. I've also seen other similar efforts to configure Spring in other languages, including one awhile back called Springy that let you configure it in Ruby.

I don't cover those in the book, though. Even so, they're great configuration options to consider. I especially like the Groovy configuration stuff. Configuring in Java or Groovy (or any other language) rather than XML buys you a lot of benefits, including less of a dependence on string identifiers, more type safety, testability of the configuration themselves, and the ability to write intelligent configuration (configuration that takes advantage of language constructs to do more than just simply create objects and set properties...make decisions, loop, etc).


I did not quite understand this. replace XML or JavaConfig with Groovy?
 
Piotr Kalinowski
Greenhorn
Posts: 6
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig Walls wrote:You can certainly replace XML or JavaConfig with Groovy. In fact, that's what the Groovy configuration stuff from Grails does. I've also seen other similar efforts to configure Spring in other languages, including one awhile back called Springy that let you configure it in Ruby.
(...)


Thank you very much for the answer. I am a novice in Spring. I am working on my first project that uses this framework and still learning it. Groovy and Grails seem to be quite interesting - I hope I will have time to learn them, too.
 
Vic Hood
Ranch Hand
Posts: 477
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Harry wrote:
Craig Walls wrote:You can certainly replace XML or JavaConfig with Groovy. In fact, that's what the Groovy configuration stuff from Grails does. I've also seen other similar efforts to configure Spring in other languages, including one awhile back called Springy that let you configure it in Ruby.

I don't cover those in the book, though. Even so, they're great configuration options to consider. I especially like the Groovy configuration stuff. Configuring in Java or Groovy (or any other language) rather than XML buys you a lot of benefits, including less of a dependence on string identifiers, more type safety, testability of the configuration themselves, and the ability to write intelligent configuration (configuration that takes advantage of language constructs to do more than just simply create objects and set properties...make decisions, loop, etc).


I did not quite understand this. replace XML or JavaConfig with Groovy?

Same here
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although not part of Spring (yet anyway), the Grails folks have a thing called the Grails BeanBuilder (http://www.grails.org/doc/1.4.x/guide/14.%20Grails%20and%20Spring.html#14.4%20The%20BeanBuilder%20DSL%20Explained) that lets you express a Spring configuration with a Groovy-based DSL. Although part of the Grails project, it can be used outside of Grails as well.

At one time there were plans to make this part of Spring 3.1. But now it looks like it's in the 3.2 backlog. See https://jira.springsource.org/browse/SPR-7123 for more details.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic