spring

Understanding Spring annotation DI

@Repository @Service @Controller @Component -->only use for spring managed bean (no need weaving) -->@repository, @Service @controller is actually a @Component , just naming easier for programmer to understand @Configurable --->used for non spring managed bean (use with weaving) @Autowired --> use for DI for both cases abo...

Hibernate Configuration Xml

Hi. I am developing a java web application using hibernate as ORM. Is it possible to merge Hibernate.cfg.xml with the applicaion-config.xml? ...

Spring-Drools integration?

There used to be spring-modules project that provides this integration; however, that project is deprecated now. Does anyone now if there is any continued support for this integration? Thanks. ...

xapool connection timed out

I'm using xapool (org.enhydra.jdbc.pool.StandardXAPoolDataSource) with Spring and JPA and I'm getting connection timed out errors. I found the "checkLevelObject" setting, but it doesn't seem to have helped. Should that have fixed it? Are there other setting that I could use to test the connections and have them replaced without impacting...

Proper ApplicationContext usage?

I've recently started learning the Spring Framework, and I'm a bit unclear on how the ApplicationContext is supposed to be used - in both standalone and web applications. I understand that the ApplicationContext, once instantiated with the spring configuration xml, is the "spring container" and is a singleton. But: In the starting po...

Referencing beans in xml config created via Annotations

This must be possible but I can't work out how or see it in the docs. I need to reference a bean which has been created via an annotation @Service and context:component-scan, within a spring xml config file. How is this achieved? Cheers ...

How to call stored procedure to read return value and out parameter both in Spring?

I have a stored procedure which returns an Integer as well as an Out Parameter which is of type VARCHAR. I am using Spring 2.5.6 and unable to find a way to read the return value as well as Out Parameter at the same time. SimpleJdbcCall.executeFunction(..) have a facility to read the stored procedure return value but no facility for Ou...

Hibernate is not able to load a JAR file if my directory name contains space!

Hello, I have an application that is based on Swing, Spring 2.5.2, Hibernate 3.3.1. If my application is run from a directory that contains a space character, for example D:\hudson\jobs\FooBar - Fast Build, then I get this error: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFacto...

In spring, what code is used to inject the value for the @PersistenceContext annotated variables?

Using a ClassPathXmlApplicationContext object I want to get the same EntityManager that is being used by other parts of the app which get it injected via: @PersistenceContext(unitName="accessControlDb") private EntityManager em; Using ctx.getBean("access-emf") I can get the EntityManagerFactory which is defined in the applicationConte...

Group and acl on Spring Security

Hello, I want to use Spring Security to manage user, group and permissions. I want to use ACL to secure my domain objects but I can't find a way to assign a group to an acl. For example: I've got users and groups. Each group can have the following securities: - manage forums (can be a role like ROLE____FORUM____MANAGER) - edit a speci...

Tomcat not showing Spring Context initialization errors when running from Eclipse WTP

Hi all, Im working with Eclipse Galileo (WTP), Spring 2.5.6-SEC01 and Apache Tomcat 5.5.28. When I run my application from Eclipse, I'm able to see Tomcat standard output and error from the console view. When there is a Spring initialization error (ex: malformed spring XML) I'm not able to see the error message or the stacktrace at th...

What's the difference between how @Component and @Repository / @Service annotations are processed?

I've stumbled upon a rather strange issue today with Spring 3.0: There's an abstract class A and its concrete implementation A_Impl. A_Impl is annotated as @Repository and is auto-scanned by Spring (<context:component-scan> and <context:annotation-config/> are both declared in context). A and A_Impl are deployed in separate JARs (not su...

Passing parameters from trinidad controls to the flow

Hi, I am new to JSF, Facelets, SWF and Trinidad technologies, and I having a problem submitting parameters from the <tr:commandButton> on a xhtml page to the flow (using the <f:param>). The interesting thing is when I use <h:commanButton> instead of the <tr:commandButton>, everything works fine. The reason I need to use trinidad button ...

JPA Spring Hibernate Dao List problem

I am using JPA/Spring/Hibernate as my persistence mechanism for my application. Currently I am running into unit test problems where when I ask for some objects I get the right amount returned from the DAO that correspond to the number of rows in the database, but they are all of the exact same instance. Here is the findByName() metho...

Equivalent Spring custom Collection property editor when using JSF

Hi, I would like to know how to use Converters in Java Server Faces similar to Spring collection property editor Suppose the following model public class Group { private String name; List<User> users = new ArrayList<User>(); // getter's and setter's } And equivalent form <form ...> <h1>Group form</h1> <label ...

Spring - config apache commons email

I want to use HtmlEmail in apache commons-email in a spring app, so i use the config xml as following: <bean id="commonsEmail" class="org.apache.commons.mail.HtmlEmail"> <property name="hostName" value="smtp.example.com" /> <property name="TLS" value="true"/> <property name="smtpPort" value="587"/> </bean> But i can't initialize it...

Spring MVC form:options tag not wiring into my objects Id?

I am trying to display my command objects collection field inside a list box. Inside said collection is a field, id and name. I want use the id as the html option value and the name as the option text. See the code below; <form:select id="customCollection" path="customCollection" size="10"> <form:options items="${command.customColle...

Log4J - SiftingAppender-like functionality

I work in a project that uses Log4J. One of the requirement is to create a separate log file for each thread; this itself was a odd issue, somewhat sorted by creating a new FileAppender on the fly and attaching it to the Logger instance. Logger logger = Logger.getLogger(<thread dependent string>); FileAppender appender = new FileAppende...

Setting up Spring and Tomcat in eclipse?

I am having some trouble getting Spring and Tomcat up and running and recognized by eclipse. I have looked around on google with no luck. Specifically, I am having trouble having eclipse recognize tomcat (I am running linux, and when I browse to the relevant jar file in the runtime environments configuration, eclipse wont allow me to s...

Using spring to configure application properties

As I already have application.properties, where the database connection settings are defined, I decided it is good to put my application-specific settings in that file too. A step further - as spring reads those properties, I declared my Settings bean as follows <bean name="settingsBean" class="com.tickets.constants.Settings"> <prop...