I am writing some JUnit tests that verify that an exception of type MyCustomException is thrown. However, this exception is wrapped in other exceptions a number of times, e.g. in an InvocationTargetException, which in turn is wrapped in a RuntimeException.
What's the best way to determine whether MyCustomException somehow caused the exc...
I am looking for a generic asynchronous Java job execution framework that could handle Callables or Runnables. It would be similar to java.util.concurrent.ExecutorService, (and possibly wrap ExecutorService), but it would also have the following features:
The ability to persist jobs to a database in case the application goes down while...
A while back I wrote an application which used Spring AOP for defining which methods were transactional. I am now having second thoughts as to how much of a great idea this was; I have been hit a few times after a minor refactor (changing method signatures etc), which of course doesn't become apparent until something actually goes wrong ...
I would like to create an object client side and add it to another object.
I'm using velocity and Spring.
I form a command object and pass it to the view as a backing object.
I want to create and add a new object to this command object without saving either object to the db.
The reason for this is that I want to have some persistence...
Coming from a C++ background I have to master the complexity of the Java
world and its frameworks. Looking at the spring framework for DI I am
finding it difficult to believe that I have to make each setter function
which will be subject for DI public. Doesn't that requirement break the
principle of information hiding?
Of course I...
What are the advantages and disadvantages for Spring vs. Jboss for an enterprise web application.
...
I am having a hard time understanding JAAS. It all seems more complicated than it should be (especially the Sun tutorials). I need a simple tutorial or example on how to implement security (authentication + authorization) in java application based on Struts + Spring + Hibernate with custom user repository. Can be implemented using ACEGI....
What is Spring Framework?
What's its contribution to Hibernate?
...
I am using the spring security to restricted urls. I am trying to provide signup and login page, on the same page.
On login spring security transfers to the restricted page. However i am trying to pass the target url to the signup process, so that after signup we can redirect to the restricted page.
How to get the actual URL that user ...
Does Spring's Controller have any sort of destroy/cleanup method? I couldn't find anything in the JavaDocs for Controller and AbstractController. I'm looking for the equivalent of javax.servlet.Servlet's destroy() method.
The reason for this is that I'm starting a thread in my Spring controller. I want the thread to terminate whenever t...
I am attempting to create a web application using Spring MVC, with Hibernate as its ORM layer. However, due to my inexperience with both frameworks I'm struggling.
The following code will properly display all the records I am looking for but still throw a stack trace into my logs. I'm having trouble finding thorough documentation concer...
What are the pros and cons of using @Autowired in a class that will be wired up by Spring?
I probably just don't understand it, but to me it almost seems like an anti-pattern - your classes start to become aware that they are tied to a DI framework, rather than just being POJOs. Maybe I'm a glutton for punishment, but I like having t...
Hello,
I'm looking to launch a separate Java process from within an instance of a Spring controlled bean that runs in a Jetty container. The Jetty instance was launched from mvn jetty:run
This separate process communicates with the launching process via RMI and I'd like to be able to maintain a hook to the process's ID or Process objec...
How could I integrate Spring with Hibernate using sql server 2005 and have Unicode support.
I tried many different ways but I just couldn't get it to work.
Column in the table is nvarchar, character set in Spring is UTF-8.
I can read Unicode text (which I added myself using the sql server management tool) just fine but writing doesn't w...
I need to interface an existing application with Acegi/Spring security.
In order to get started I am looking for one simple piece of information: in this context, will HttpServletRequest.getUserPrincipal() called from my application properly return the username obtained through Spring (as opposed to using Spring-specific objects)? I hav...
I've written the following Spring JDBC API StoredProcedure sub-class:
class GetLdapPropertiesStoredProcedure extends StoredProcedure {
protected GetLdapPropertiesStoredProcedure(JdbcTemplate jdbcTemplate) {
super(jdbcTemplate, "get_ldap_properties");
setFunction(true);
declareParameter(new SqlReturnResultSet("rs", new Produ...
Hello,
Without thinking about it too much, I've been doing something like the following:
1) building a list of SomeBean objects based on the results of a database call
2) putting that list in my command object
3) building a form based on that command object where users can modify attributes of the SomeBeans
4) extracting data out of...
I am using spring-2.5.6 to connect from a standalone application to an Oracle 10g database (ojdbc14.jar) using the org.apache.commons.dbcp.BasicDataSource. When I try to retrieve a SqlRowSet using the public SqlRowSet queryForRowSet(String sql, Object[] args) throws DataAccessException method I am getting an 'java.sql.SQLException: Inval...
I want to implement an intialization mechanism that is annotation-based in Java. Specifically, I have an annotation I've defined:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Initialization {
/**
* If the eager initialization flag is set to <code>true</code> then the
* initialized class will be i...
I have a series of code books in my database, and I am using plain JDBC calls to fetch them and store them in a collection. I would like to put these in some kind of a cache at application startup time in order to save time later.
I don't need any fancy stuff like automatic object invalidation, TTL etc - the code books change rarely, so...