• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring in Action - other programming languages?

 
Greenhorn
Posts: 6
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 477
Eclipse IDE Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 422
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic