spring

Using Spring AOP in an JSF application

consider a JSF web application with a managed bean FooBean.java. I've declared this "FooBean" in my faces-config.xml file. Now, if I want to add the Spring AOP advice for the methods of FooBean, how do I do that? Should I add an applicationContext.xml file and declare the managed beans inside it? or will it work even if I am not decl...

Recommended usage of Spring's @Required annotation

I see that Spring has a @Required annotation to mark member variables in beans that must be set. Is there a best practice for using this? For instance, might it be better to set these values in the constructor and make these parameters explicitly required (esp. when used outside of Spring)? Thanks! ...

What do I need to download to start developing apps using the Spring framework?

I need to start developing applications using the Spring framework, and am wondering what tools I need to download to have me up and running. On the SpringSource website I am seeing all these applications to download and I am wondering, do I really need all this? And what versions should I use, especially for Spring Framework? Spring...

Spring Security: Advice needed on how to handle GrantedAuthority

I have a concern when it comes to GrantedAuthority objects in a Spring Security application. I'm looking for a good way to handle things. First of all I'm trying to describe my concern, if there are any factual errors do not hesitate to point them out, I'll only be greatful. Spring Security uses GrantedAuthority instances to act as toke...

What applications do i need to download to start developing apps using spring framework?

Guys, I need to start developing applications using spring framework, and am wondering what tools do i need to download to have me up and running. On the springsourcewebsite am seeing all this applications to download and am wondering do i really need all this? And what versions should i use, especially for Spring Framework? * Spring...

swing editor ui for applicationContext.xml beans?

I asked this in spring forums but got no answer, and I just discovered stackoverflow, so Ill try here. I am using spring 2.0.5. In my app I need to let the user add/modify/delete (via the UI) beans that are described in the applicationContext.xml file. The beans that are to be edited are all of the same class (like a db table crud edito...

Obtaining a Hibernate transaction within a Spring class

I am working on a program that uses Spring and obtains Hibernate transactions transparently using a TransactionInterceptor. This makes it very convenient to say "when this method is invoked from some other class, wrap it in a transaction if it's not already in one." However, I have a class that needs to attempt a write and must find ou...

Best book/ tutorial to learn/implement web services using java, xml and spring.

Hi, I am a newbie to web-services. What is a good way to learn web-services implementation using java, xml and spring? Are there any good books which cover this topic in good width? Or, are there any online resources, tutorials, etc.? Also, what would be good projects to understand this hands-on? Any recommendations>? ...

Large ResultSet on postgresql query

I'm running a query against a table in a postgresql database. The database is on a remote machine. The table has around 30 sub-tables using postgresql partitioning capability. The query will return a large result set, something around 1.8 million rows. In my code I use spring jdbc support, method JdbcTemplate.query, but my RowCallbackH...

Why does Spring's @Configurable sometimes work and sometimes not?

I'm trying to use automatic dependency injection via Spring's @Configurable annotation w/ @Resource on the fields needing injection. This involved some setup, like passing spring-agent.jar to my JVM. For the full details see here. It works... mostly. When my Tomcat is booting up, I see the AspectJ init messages, my User objects automati...

Learning Path: Struts1 -> (Struts2 or Spring)

After having read and used (made a web application using Struts/Hibernate last semester) Struts1, I want to step forward in learning a better MVC framework. I have been wondering if it would be more prudent to learn Struts2 now and Spring later, or skip Struts2 for Spring directly? ...

Getting the field and table name that caused an exception from a SQL Exception object

I'm using Hibernate JPA and Spring in my project. Suppose if I try to insert a record with duplicate key value, the insert query will throw an exception. Now, is it possible to get the table name, field name and possible cause for the exception from the SQL Exception object at run time !? ...

Spring prototype beans in combination with singleton beans and dependency injection. Is there an approach that is configuration only?

Hi all, I have a singleton bean which needs for each call of a function to return a reference to a different (new) prototype bean. The only way that I can think of doing this is to programmatically retrieve a new prototype bean instance from the BeanFactory/ApplicatioContext by invoking its getBean() method. Code sample will follow... I...

Spring WS calling .net web services

Hi Gurus, I have to call this webservices which is a .net web services (well.. WS should be pretty platform independent I guess) I have attached the WSDL below. I am using Spring WS 1.5.6. I am not sure what to put in the message. Do I have to include the namespace etc? and Do I need to specify the method name etc? (Second thought i...

is there a way to force a transactional rollback without encountering an exception?

I have a method that does a bunch of things; amongst them doing a number of inserts and updates. It's declared thusly... @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false) public int saveAll(){ //do stuff; } It works exactly as it is supposed to and I have no problems with it. There ar...

Spring 2.5 in EJB container

Hi, I would like to use the spring framework within an EJB3 project. In detail I would like to use the JDBC template class which should be instantinated from a given data source. When I put the spring.jar to my Jboss lib directoy everything is working fine. But when I put the JAR inside my EAR only there seems to be external dependencie...

Trouble stopping Tomcat due to apparent threading issue..

With our Java webapp running on Apache Tomcat 6.0.18 on Ubuntu with Java 1.6.0_6, we can stop tomcat just fine. However, with the same war file deployed to a Apache Tomcat 6.0.18 on Red Hat Enterprise Linux with Java 1.6.0_13, calling /etc/init.d/tomcat6 stop does not stop Tomcat. I have not yet attempted using 1.6.0_6 on Red Hat to ...

Build strings with Spring?

I'm getting reacquainted with Spring and looking at dependency injection and IoC in a way I haven't before. If I want to build a string, say for a file name, and I already have a Spring bean which contains the directory, what is the best way to append the file name? Writing a bean to do this myself seems fairly trivial, but I would thi...

Can Spring initialize "non-bean" fields?

I have initialized a java.util.logging.Logger bean and now want to add a Handler which I've also created a bean for. The trouble is the Logger method is called addHandler instead of something like setHandler. How can I inject the handler into the logger? Do I need to wrap Logger in a Spring-friendly bean class? EDIT If someone can...

SQLServer deadlock

Hi, I have a java application which is doing multiple concurrent CRUD operations on a database. I'm adding support for SQLServer but am having problems with deadlocking during concurrent deletes. After some investigation it appeared that the problem may be due to lock escalation on a particular table. In an attempt to fix it, I decide...