Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Spring in a non J2EE application

 
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I'm developing a pure api for managing users , customers in our organisation.
I use Maven as build, Hibernate as ORM and C3P0 for pooling.

My question is: Should I use Spring with this? Is spring only used in webapplications or is it used in
standard applications or Swingapplications?
 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Mathias Nilsson:
Hi!

I'm developing a pure api for managing users , customers in our organisation.
I use Maven as build, Hibernate as ORM and C3P0 for pooling.

My question is: Should I use Spring with this? Is spring only used in webapplications or is it used in
standard applications or Swingapplications?



If I understand it correctly you want to create an application not an API.
Even in the case of an API you could use DI and decouple all the dependencies. I imagine it more like a business module that has dependencies that can be wired in as a spring bean and be used in the application. Is that what you really want?

Programming to interfaces is generally a good practice so I encourage it.
 
Ranch Hand
Posts: 1325
Android Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I get from the Article written by Rod Johnson - Founder of Spring Framework.

"Spring BeanFactories are very lightweight. Users have successfully used them inside applets, as well as standalone Swing applications."

hope this article makes enable to you, to step forward.
 
Mathias Nilsson
Ranch Hand
Posts: 367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! That was exactly what I wanted to here. I thing the only thing odd, even if I haven't used spring just read some that the "new" keyword is gone.

Makes it hard to integrate with Wicket.

Thanks
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to add one thing here. Spring is basically a dependency injection framework. It provides an sort of layer many java implementation APIs like Email messaging ,JDBC, JMS etc. The concept behind it was to keep the developer away from the code which is common for every application using these
APIs such as taking a connection creating a connection with the database. And spring also provides a very nice concept of dependency inject using spring can be used to develop simple standalon java code also for ex:-

Simple POJO class:-

Class SpringTest{

private String employeeName;

public String getEmployeeName(){

return this.employeeName
}
public setEmployeeName(String employeeName){
this.employeeName = employeeName;
}
}

Spring configuration:-

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE beans PUBLIC "-//SPRING/DTD BEAN/EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id = "springTest" class ="SpringTest">
<property name="employeeName" value ="ABC"/>
</bean>
</beans>

Now the class which want to use the springTest bean will be just calling the springTest bean this will provide the object of SprinTest class with the state employeeName set as ABC.

Spring is really a beautifull framework to use when you are developing a big application .

Regards

Guru
 
"To do good, you actually have to do something." -- Yvon Chouinard
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic