-
Chris Richardson's Spring library to autocreate bean definitions (12 messages)
- Posted by: Joseph Ottinger
- Posted on: May 03 2007 10:16 EDT
Chris Richardson has made the source code for his Arid POJOs library available. Arid POJOs defines a custom namespace for Spring 2, that allows users to automatically define Spring bean references based on AspectJ naming conventions, instead of having to manually create each one. For example, to define Spring references for every bean in the net.chrisrichardson.arid.example.dao package, he shows the following node in Spring's XML configuration:He says that there's an algorithm that determines the Spring name based on the concrete class, so that "AccountDaoImpl" would be created in Spring's application context as "accountDao." This is a very simple example; Arid POJOs can do more, from specifying more concise rules about what beans are created in Spring's context to managing specific injection cases. See Chris' site for more details on using Arid POJOs until the Google Code project is more fleshed out; you can also use Maven to pull down Arid POJOs.Threaded Messages (12)
- Whip up a custom RoR/Grails configure by convention? by George Coller on May 03 2007 12:51 EDT
- Configuration by convention by Gabriel K. on May 07 2007 04:39 EDT
- Re: Configuration by convention by George Coller on May 07 2007 10:15 EDT
- Re: Configuration by convention by George Coller on May 07 2007 10:15 EDT
- Configuration by convention by Gabriel K. on May 07 2007 04:39 EDT
- It's these ideas that make a difference. by Richard Burton on May 03 2007 13:47 EDT
- Re: It's these ideas that make a difference. by George Coller on May 03 2007 14:24 EDT
- Re: It's these ideas that make a difference. by Casual Visitor on May 04 2007 10:48 EDT
-
Re: It's these ideas that make a difference. by Wesley Hall on May 04 2007 11:11 EDT
- Re: It's these ideas that make a difference. by Amin Mohammed-Coleman on May 04 2007 12:15 EDT
-
Re: It's these ideas that make a difference. by Richard Burton on May 04 2007 01:57 EDT
- Re: It's these ideas that make a difference. by Casual Visitor on May 06 2007 04:20 EDT
- Re: It's these ideas that make a difference. by George Coller on May 04 2007 02:31 EDT
-
Re: It's these ideas that make a difference. by Wesley Hall on May 04 2007 11:11 EDT
-
Whip up a custom RoR/Grails configure by convention?[ Go to top ]
- Posted by: George Coller
- Posted on: May 03 2007 12:51 EDT
- in response to Joseph Ottinger
First thing that strikes me is that for a project you could easily whip up your own "configure-by-convention" scheme a la (Ruby on Rails/Grails). Spring configuration bloat is a yucky side-effect of a beneficial platform. I'm wondering how far you could take this idea on a decent sized project. Note, I'm not talking about just web apps here but any spring-based application. 1) Decide on a packaging layout that will enable configure by convention 2) Use Arid POJOS to make a minimal Spring file to enforce that convention 3) Put your daos, services, business logic, controllers, etc in the correct packages with the correct naming scheme and never need to touch the Spring configuration file again. (yeah, right - but you see where I'm going?) -
Configuration by convention[ Go to top ]
- Posted by: Gabriel K.
- Posted on: May 07 2007 04:39 EDT
- in response to George Coller
I agree with that way of thinking. Most of the time, our beans are in 2 or 3 packages : xxx.daos, xxx.managers, xxx.services. That's a fact. Arid should even be included in Spring, as it has the Spring state of mind: find simple solutions -
Re: Configuration by convention[ Go to top ]
- Posted by: George Coller
- Posted on: May 07 2007 10:15 EDT
- in response to Gabriel K.
I agree with that way of thinking. Most of the time, our beans are in 2 or 3 packages : xxx.daos, xxx.managers, xxx.services.
Spring 2.0 has Aspect J built in, right? I've recently started playing with 2.0 so I'm not sure how far this goes. Just wondering if Arid needs to exist or if it builds off of what is in Spring? I'm planning on spending some time this week digging into this a bit to see what the easiest way to get some CbC (configuration by convention) goin'on in Spring.
That's a fact.
Arid should even be included in Spring, as it has the Spring state of mind: find simple solutions -
Re: Configuration by convention[ Go to top ]
- Posted by: George Coller
- Posted on: May 07 2007 10:15 EDT
- in response to Gabriel K.
I agree with that way of thinking. Most of the time, our beans are in 2 or 3 packages : xxx.daos, xxx.managers, xxx.services.
Spring 2.0 has Aspect J built in, right? I've recently started playing with 2.0 so I'm not sure how far this goes. Just wondering if Arid needs to exist or if it builds off of what is in Spring? I'm planning on spending some time this week digging into this a bit to see what the easiest way to get some CbC (configuration by convention) goin'on in Spring.
That's a fact.
Arid should even be included in Spring, as it has the Spring state of mind: find simple solutions -
It's these ideas that make a difference.[ Go to top ]
- Posted by: Richard Burton
- Posted on: May 03 2007 13:47 EDT
- in response to Joseph Ottinger
Configuration by convention is one of a few concepts I believe can help make developers much more productive. Maven embraces this (Although Maven isn’t perfect) and because of that, productivity in the build process increases. Spring utilizes configuration by convention in its wiring mechanism which also improves productivity in developing applications. Other things I believe are powerful and productive include: 1. Keeping components lightweight – Good examples of this are Hibernate, EJB 3, Spring, and Mule. They employ good practices and help make developing applications easier and faster. 2. Design by Contract – I can't stress enough about how important contracts are. Contracts/Interfaces are not easy to change. I strongly recommend reading/watching the presentation "How to Design a Good API & Why it Matters" by Joshua Bloch 3. Utilize patterns consistently – Use patterns in a consistent manner. If you look how the Spring source code is written, you’ll see patterns being used consistently making learning the API easier. I think this extension to Spring is a very good one and worth while. I can't wait to see how Annotations will be abused in the year to come. Let's see, we have JPA + Guice + 100 other frameworks that will embrace Annotations instead of XML. I hope people start to understand there needs to be a balance. XML + Annotations + Java Code. Best regards, Richard L. Burton III -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: George Coller
- Posted on: May 03 2007 14:24 EDT
- in response to Richard Burton
Configuration by convention is one of a few concepts I believe can help make developers much more productive. Maven embraces this (Although Maven isn’t perfect) and because of that, productivity in the build process increases. Spring utilizes configuration by convention in its wiring mechanism which also improves productivity in developing applications.
I think I agree with everything you wrote. Spring has auto-wiring conventions but it doesn't go quite as far as what I was proposing. You still have to manually configure the beans themselves, Spring only auto-wires the dependencies. What I was proposing was that you wouldn't even have to specify the beans either - that just placing a DAO/DAOImpl in the correct package would make it known to Spring.
Other things I believe are powerful and productive include:
1. Keeping components lightweight – Good examples of this are Hibernate, EJB 3, Spring, and Mule. They employ good practices and help make developing applications easier and faster.
2. Design by Contract – I can't stress enough about how important contracts are. Contracts/Interfaces are not easy to change. I strongly recommend reading/watching the presentation "How to Design a Good API & Why it Matters" by Joshua Bloch
3. Utilize patterns consistently – Use patterns in a consistent manner. If you look how the Spring source code is written, you’ll see patterns being used consistently making learning the API easier.
I think this extension to Spring is a very good one and worth while. I can't wait to see how Annotations will be abused in the year to come. Let's see, we have JPA + Guice + 100 other frameworks that will embrace Annotations instead of XML. I hope people start to understand there needs to be a balance. XML + Annotations + Java Code.
Best regards,
Richard L. Burton III -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: Casual Visitor
- Posted on: May 04 2007 10:48 EDT
- in response to Richard Burton
Keeping components lightweight – Good examples of this are Hibernate, EJB 3, Spring
If Hibernate, EJB 3, Spring are lightweight what's heavy? -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: Wesley Hall
- Posted on: May 04 2007 11:11 EDT
- in response to Casual Visitor
If Hibernate, EJB 3, Spring are lightweight what's heavy?
J2EE 1.4 -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: Amin Mohammed-Coleman
- Posted on: May 04 2007 12:15 EDT
- in response to Wesley Hall
+1 -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: Richard Burton
- Posted on: May 04 2007 13:57 EDT
- in response to Casual Visitor
I never said Spring, Hibernate, EJB 3.x were lightweight themselves. Look at anything < EJB 3.x and they rely on implementing interfaces and such. Best Regards, Richard L. Burton IIIKeeping components lightweight – Good examples of this are Hibernate, EJB 3, Spring
If Hibernate, EJB 3, Spring are lightweight what's heavy? -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: Casual Visitor
- Posted on: May 06 2007 16:20 EDT
- in response to Richard Burton
I never said Spring, Hibernate, EJB 3.x were lightweight themselves. Look at anything < EJB 3.x </blockquote> That's the point. You need to compare them to something even more complicated. Java EE development as such has become needlessly intricate and clumsy. Many frameworks praise their simplicity but just add more layers of framework interfaces and configuration mess to the game.
and they rely on implementing interfaces and such.
I know what you mean but implementing interfaces is not per se considered a bad thing in OO languages. -
Re: It's these ideas that make a difference.[ Go to top ]
- Posted by: George Coller
- Posted on: May 04 2007 14:31 EDT
- in response to Casual Visitor
Arg. This is what I don't like about TSS. Too many trolls that like to go off topic and pretend ignorance. Don't feed the trolls.Keeping components lightweight – Good examples of this are Hibernate, EJB 3, Spring
If Hibernate, EJB 3, Spring are lightweight what's heavy?