spring

How to define a field in spring-roo which appears on the page but doesn't get persisted.

Q1> In spring-roo how can I define a field that I want to appear on the page but doesn't get persisted in the DB. For e.g: If I have a confirm-password field that I want to appear on the page so that I can validation the password but don't want to persist it. Q2> Is there a way to define a password field directly form roo shell. ...

Spring Security: Redirect to invalid-session-url instead of logout-success-url on successful logout

Hi, I have implemented a login-logout system with Spring Security 3.0.2, everything is fine but for this one thing: after I added a session-management tag with invalid-session-url attribute, on logout Spring would always redirect me on the invalid-session-url instead of the logout-success-url (which it correctly did before). Is there a ...

Mapping to a JSON method with url-pattern

I'm creating a Spring MVC application that will have a controller with 'RequestMapping'-annotated methods, including a JSON method. It currently has static content that resides in webapps/static, and the app itself resides in webapps/myapp. I assume that Catalina's default servlet is handling the static content, and my *.htm url-pattern ...

Any open source Spring sample project that's bigger than PetClinic?

I've finished reading the spring doc and the PetClinic sample project. Just like to see some bigger real world project that's done with Spring. Thanks. ...

spring - @ContextConfiguration fail to load config file in src/test/resources

Hi, I've tried to load the spring config file in src/test/resources classpath with the following abstract class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:/applicationContext.xml"}) public class BaseIntegrationTests { } I have the applicationContext.xml file in src/test/resources but spring ...

Spring web: Controllers with annotated mappings - Getting HttpServletRequest / form data

Hi, I have a controller mapped using annotations; the URL is being accessed by the client app and it sends POST / GET data. How do I access the request object in this method? Thanks, ...

Java spring framework - how to set content type?

Hi, I have a spring action that I am rendering some json from the controller, at the minute its returning the content type 'text/plain;charset=ISO-8859-1'. How can I change this to be 'application/json'? Thanks Jon ...

Render different tile baseon request parameter (Springframework & tiles)

Hi all, I need to change some existing application to render different view depending on some request parameter. This application is using tiles. I never used tiles before, and need a bit of hint how to go about doing this. Tiles are defined as follows: <bean id="viewResolver"class="org.springframework.web.servlet.view.UrlBasedViewRe...

Spring Security RememberMe Services with Session Cookie

I am using Spring Security's RememberMe Services to keep a user authenticated. I would like to find a simple way to have the RememberMe cookie set as a session cookie rather than with a fixed expiration time. For my application, the cookie should persist until the user closes the browser. Any suggestions on how to best implement this?...

Share spring beans in teracotta

Wondering why we need to share spring beans in case if there are no static data inside? ...

Spring Dependency Injection with TestNG

Spring support JUnit quite well on that: With the RunWith and ContextConfiguration annotation, things look very intuitive @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:dao-context.xml") This test will be able to run both in Eclipse & Maven in correctly. I wonder if there is similar stuff for Test...

Is it possible to configure a Spring session scoped bean with attributes from the session?

I'm trying to create a service bean that when referenced will be initialized with HttpSession based attributes. Let's say for sake of argument that my webapp would do the following: Establish a session Request login & password When service is requested (it is scope="session" and has init-method="init()") a new instance is created for ...

Spring @PostConstruct function in a @Repository called multiple times

I have a DAO that I'm trying to inject into a couple different places: @Repository public class FooDAO { @Autowired private HibernateManager sessionFactory; @PostConstruct public void doSomeDatabaseStuff() throws DataAccessException { ... } } And my application-context.xml is a fairly simple context:co...

Intercepting method with Spring AOP using only annotations

In my Spring context file I have something like this: <bean id="userCheck" class="a.b.c.UserExistsCheck"/> <aop:config> <aop:aspect ref="userCheck"> <aop:pointcut id="checkUser" expression="execution(* a.b.c.d.*.*(..)) &amp;&amp; args(a.b.c.d.RequestObject)"/> <aop:around pointcut-ref="checkUser" ...

Brainstorming: Weird JPA problem, possibly classpath or jar versioning problem???

I'm seeing a weird error message and am looking for some ideas as to what the problem could be. I'm sort of new to using the JPA. I have an application where I'm using Spring's Entity Manager Factory (LocalContainerEntityManagerFactoryBean), EclipseLink as my ORM provider, connected to a MySQL DB and built with Maven. I'm not sure i...

Spring, autowire @Value from a database

I am using a properties File to store some configuration properties, that are accessed this way: @Value("#{configuration.path_file}") private String pathFile; Is it possible (with Spring 3) to use the same @Value annotation, but loading the properties from a database instead of a file ? ...

Unbelievable: Cannot cast from class X to its super class

I'm encountering a very weird problem with Spring (3.0.1.RELEASE), TestNG (5.11) and Maven Surefire (2.5). I have a test class that extends a Spring helper class for testNG so that test context can be loaded from an xml file (that contains some bean definitions). My project was imported into eclipse using m2eclipse (using Import Maven Pr...

Spring Security Issue: Controller, Anonymous Requests...

Hey guys, I have an app that uses Spring security and BlazeDS. Flex 3.2 is used for the client app. Generally client app makes service calls using RemoteObjects. However, for certain cases client app is sending a request to a URL. We're using Annotated Controllers for URL mapping. Here's where the "Access is denied" exception comes up:...

Properties framework in java apps

Hi All I have been using spring for a while as my IOC. It has also a very nice way of injecting properties in your beans. Now I am participating in a new project where the IOC is Guice. I dont understand fully the concept how should I inject properties in to my beans using Guice. The question : Is it actually possible to inject raw p...

Compile classfile issue in Spring 3

I have used spring framework 3 for my application. Everything is ok while developed in Netbeans But i need a custom build and done for the same The build created without any issue, but i got the following error The error occurred while calling the following method @RequestMapping(value = "/security/login", method = RequestMethod....