spring

Shared bean between portlets in separate war files

I'm developing a 'user settings portlet' where users can effect the search behaviour of multiple other portlets. The way I'd like to do it is by a shared bean. All portlets are in different wars, and I'd rather avoid having all wars in a single ear and using a parent application context, so deployment of portlets can be made autonomously...

Flex 4, Spring 3 with Hibernate & MySQl setup + configuration issues.

Hi All, This kind of question has been asked before, but has not been well supported at StackOverlfow...maybe because some people think its elementary..but beginners like me have spent days on this but to no avail. Kindly help [I'm sure its going to be an ever occurring issue] I'm trying to make a flex project and want to integrate Spr...

junit 4 testing with spring 3.0 and Hibernate 3 in Eclipse - LazyInitializationException

I'm getting a LazyInitializationException trying to test my DAO methods using the tool stack defined in the title. My understanding is that my test must be running outside the hibernate session, or it has been closed before I try to read children objects from my DAO. From reading the documentation, I understood that using the @Transact...

Error when publishing Spring application to Geronimo web server

I'm trying to set up Spring with Geronimo web server, but I'm getting the following error: 2010-10-08 18:52:45,105 WARN [PathMatchingResourcePatternResolver] Cannot search for matching files underneath URL [bundle://316.0:1/com/unveiled/politics/] because it does not correspond to a directory in the file system java.io.FileNotFoundExce...

No adapter for handler exception

Hi, I'm developing a web application using spring mvc framework. I want to to both annotation and beanName based url mappings. I've the following configurations in my context file <mvc:annotation-driven /> <bean class="org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping"></bean> My annotation based controllers are wor...

Get access to all spring beans of a given type

Hi, I have a Spring application (Spring Batch not web application). In a test class, I want to grab access to all of my beans of a given type. I understand that in Spring you should generally use IOC and let the container inject your beans. However in this case, I want to loop through a variable number of beans that extend a given cla...

Dynamic Command Class in Annotated Controller

As of Spring MVC 3, AbstractCommandController is deprecated so you can no longer specify the command class in setCommandClass(). Instead you hard-code the command class in the parameter list of a request handler. For example, @RequestMapping(method = RequestMethod.POST) public void show(HttpServletRequest request, @ModelAttribute("empl...

Spring MVC: Mapping Multiple URLs to Same Controller

I have like 20+ forms which are linked from the same page. Some forms share the same controller, while others use their own. For example, form A, B, and C use DefaultController, while form D uses ControllerD. What I would like to achieve is to map the URL to each form in a consistent way. So, ideally, the link page would look like either...

how to obtain spring context reference in jpbm 4.2 EventListener?

How to obtain spring context from within EventListener instance which gets notified following this transition of process: <transition g="-36,11" name="A" to="B"> <event-listener class="com.test.handlers.MyRequestHandler"> </event-listener> </transition> I want to be able to do something like the following in my @Override publi...

Force PropertyEditor to replace String value into ClasspathResource

I am loading a Spring application context through the XmlBeanFactory(...) constructor, passing in a resource reference to the XML application context. It turns out - if I traverse the list of BeanDefinitions - I am getting null values for property values based on 'classpath:...' references. Not quite what I expect. So, if I am trying to...

Switching from ASP.NET MVC to Java

Last 8 months I have been working in ASP.NET MVC framework but now I have to switch to Java. So, I wonder what is Java's framework that is the most similar to ASP.NET MVC. I would like to stick to MVC pattern but most of my colleagues work in JSF, which doesn't seem like (real) MVC. Which one would you suggest? ...

Best grails implementation for tracking number of views (or unique visitors) for a web page ?

I need to implement a very popular feature : displaying the number of views for a profile page. For instance, my profile page in StackOverflow will display how many persons have viewed my profile (just under my reputation score). I suppose that the algorithm is based on some cookies and/or visitor IP addresses. Is there a simple way (a...

Spring MVC framework very basic Dispatcher question.

When I'm looking at Spring FrameWork 3.0 I see the following code example: @RequestMapping("/index.dlp") public ModelAndView index(){ logger.info("Return View"); return new ModelAndView("index"); } This option doesn't work for me. Only when I change the code the following way: @RequestMapping("/index.dlp") public ModelAnd...

JIRA Rest Service with Bandana Manager

I have a JIRA plugin that I'm developing that has a REST service. That service should be able to accept POSTed requests, unmarshall some data and store it. The seemingly suggested way to do this in JIRA is to make use of the Bandana persistence framework. According to this page, I should be able to simply define a setter that Spring shou...

How to read manifest.mf from POJO class (not a servlet) instantiated by spring?

I have a simple service called BuildNumberService which would be instantiated by spring. I'm trying to find the cleanest code for the class to find out the MANIFEST.MF file from the jar file it has been packaged into. The code has to run inside a servlet container. @Service public class BuildNumberService { private static final S...

Spring and a Swing application together?

Our assignment for our java project is to make a tool for kids to make math excercices. One part should be in a swing application, where the teacher can adjust settings to what the kids should make, view their results, etc... The other part is where kids should be able to make excercices on the internet. Now, so we thought, as we are se...

How do I re-open a Spring session in conjunction with OpenSessionInViewInterceptor

Hello I am using the Spring MVC framework with Hibernate. All of my controllers are using OpenSessionInViewInterceptor. I am getting "could not initialize proxy - the owning Session was closed" errors in my controller's onSubmit() method. I believe this is because Hibernate needs to go back to the database to fetch certain objects whic...

Can a Spring bean be a property of itself in its declaration in applicationContext.xml?

I need to call public methods of the rubberStampService from inside the RubberStampServiceImpl class. To reference the rubberStampService from inside itself, can I make a self-referential bean declaration like this: <beans:bean id="rubberStampService" class="com.rubberly.RubberStampServiceImpl"> <beans:property name="rubberStampSer...

Spring injection question

Hello: I have a static class ResourceFetcher with a static method fetchResource(String reference). I want to inject the resource returned by it into another class JobRunner. Can anyone specify the cleanest way of doing this? I do not want to pass ResourceFetcher into JobRunner. In fact, I have an enum with set of keys, and I need to ...

When do we use hibernate's session flush against setComplete()

Hello, I've read spring documentation regarding Hibernate's setComplete() method while working with Unit Test Cases. I am confused between setComplete() versus session's flush() method. Both are responsible to make object's state persistent in Database by loading from memory to actual Database. It will be great if somebody can help me t...