spring

User Granted Authorities are always : ROLE_ANONYMOUS ??

i am using the following method to make a programmatic login after registration private void autoLogin(User user, HttpServletRequest request) { GrantedAuthority[] grantedAuthorities = new GrantedAuthority[] { new GrantedAuthorityImpl( "ROLE_ADMIN") }; UsernamePasswordAuthenticationToken token =...

Spring security 3, infinite loop at login

Hi experts, Here is my security-context.xml file <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sec="http://www.springframework.org/schema/security" xmlns:aop="http://www.springframework.org/schema/aop" xsi:sch...

How to write tag in my spring project?

I want to write my tag (extends TagSupport) in my spring framework. In my tag class, will use some service which should auto inject by spring. But I always get null, seems spring can't inject service instance in my tag class. The code is like the following: public class FetchTagNameTag extends TagSupport { @Autowired private Tas...

Java Spring MVC Folder / Naming Conventions

I'm trying to determine the best way to organize our Maven / Spring web applications and have been looking around to see examples. Unfortunately, they seem to conflict at certain points. How should the folders be organized in a Spring MVC webapp and what should they be called? The big differences I see are: The folder for JSPs. /sr...

Configuring dynamic email content with String replace() or replaceAll()

I am using Spring MVC for my web application and I am using my applicationContext.xml file to configure my emails which I am injecting into my controllers in my spring-servlet.xml file. Some of the emails I need to send will need to be tailored to the customer that they are being sent to. Certain information in the email (First name, La...

Oracle quartz selectWithLockSQL value?

I have this in my spring config for quartz.... <prop key="org.quartz.jobStore.selectWithLockSQL">SELECT * FROM {0} LOCKS WITH (UPDLOCK ROWLOCK) WHERE LOCK_NAME = ?</prop>` That works fine for MS SQL Server, but I don't know what to...

Spring @Autowired with 2 beans of the same type

I have the following defined. @Autowired DaoType1<object1> someDao; @Autowired DaoType1<object1> someListDao; and in my bean definitions I have two beans of the same type <bean id="someDao" class="com.example.DaoType1" /> <bean id="someListDao" class="com.example.DaoType1" /> The second bean is imported from another xml file if th...

ModelandView 404 Problem

I can't realize why do I have 404 error while trying to access /liginform.dlp through POST method I have the following web.xml mapping: <servlet-name>doolloop</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> ...

Spring - how to handle exception

I am using Spring with Velocity. At times velocity produces an exception like Error in interpolating string literal : org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getMessage' in class org.springframework.web.servlet.support.RequestContext threw exception class org.springframework.context.NoSuchMess...

If you learn Spring MVC 3.0, what would you need to know to get a job working with an earlier version of Spring?

I've been learning Spring 3.0 MVC. However, from the few Spring 2.x examples I have seen, there are significant differences in earlier versions of Spring. I have two questions about getting a job working with Spring: If I am reasonably confident with Spring MVC 3.0, what would I need to learn to get a job working with a version of Sp...

JavaBeanConverter Unmarshal fails to use Constructor

So I have a class with some objects as parameters, for example: public class Person { private String firstname; private String lastname; private School school; public Person(){ super(); } } public class School{ private String name; private String location; private Date founded; public School(){ super(); } public Schoo...

spring restTemplate POST parameters from complex object

I'm attempting to test our REST service using restTemplate using the postForObject(...) method. unit test: @Test public void testPostOrder() { String url = BASE_URL + "/orders/"; OrderDto orderDtoInput = new OrderDto(); orderDtoInput.setCustomerId(34); UpdateReportDto updateReport = restTemplate.p...

Spring framework + NoSQL

Hey folks, It's already 18 hours that i'm playing with Spring framework. It's beautiful, really amazing. As far as i can see spring knows how to work rdbms databases . Can anyone tell me about experience of spring + NoSQL ( cassandra , couchdb\mongodb, redis or even HBase ) ? thanks ...

How to set transaction timeout on Jetty JNDI Atomikos configuration

I am in the process of converting various Spring beans to JNDI lookups. Currently I am using Jetty to test this. I have configured the UserTransaction according to the Jetty documentation and it works: <New id="tx" class="org.mortbay.jetty.plus.naming.Transaction"> <Arg> <New class="com.atomikos.icatch.jta.UserTransactionI...

Facebook 'secret' value, or Authenticating an app after facebook login / registration

I have an existing Spring application which I wish to also allow users to register / sign in through facebook. The facebook sign-in is working fine, and is currently executed from the client using the Actionscript-Facebook API ( which is essentially a wrapper for the Facebook JS API). However I'm unsure as to what is an appropriate app...

Spring: Bean property not writable or has an invalid setter method.

Hi guys, I'm experimenting with Spring, I'm following the book: Spring: A developer's notebook. I'm getting this error: "Bean property 'storeName' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?" .. and I'm quite lost. I have an ArrayListRentABike class wh...

Java, creating interface dynamiclly?

Hi there, I'm looking for a solution to create an interface in runtime. I don't really know if this is possible in anyway. Problem: I've got a OSGi service which publishes a Map<String,String> where the key defines an action for this service. I want to publish this service directly as Hessianservice with spring but for this, I need to...

How to use more than one custom filter invoked after each other ?

hi all i am using spring security 3.0.2 and i have one custom filter and its order is last and i want to add another filter after that filter, is the following config right ? <custom-filter position="LAST" ref="filter1"/> <custom-filter after="LAST" ref="filter2"/> ...

How to log efficiently with configurations?

I am using Spring framework in my application and it is deployed on MULE server. Based on debug or info level, the amount of logging and the percentage of logging will vary. Till date, I write the log statements explicitly in all my business logic. Is there any way to do this through configuration, say configure at some point - CLAS...

Spring-WS WSDL Generation Problem

I'm trying to make a very simple web service and am having some difficulties making spring generate the correct wsdl. I've done my best to copy the example from this spring tutorial. If anyone has a clue about what I'm doing wrong I'd really appreciate the help. In essence, there is a single EndPoint called IncidentHeaderEndpoint (which...