I was trying out spring-security for a sample web application. When declaring the LDAPAuthenticationProvider, I noticed that you have to declare all your settings with in the applicationContext.xml file!
As a spring newbie, I do understand that one would have to declare dependecies in the applicationContext file. However, in a typical ...
I would like to use the @RequestParam annotation like so:
@RequestMapping
public void handleRequest( @RequestParam("page") int page ) {
...
}
However, I want to show page 1 if the user fiddles with the URL parameters and tries to go to page "abz" or something non-numerical. Right now, the best I can get Spring to do is return a 50...
I have started by looking in following thread -
http://stackoverflow.com/questions/230763/getting-template-text-from-freemarker-in-spring-app
My spring configuration -
<bean id="fmConfig" class="org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean">
<property name="templateLoaderPath" value="/WEB-INF/templates"></...
I'm just transitioning from .NET to JAVA and have to start JAVA project with Spring 3.0.0. and Hibernate.
Can someone please explain to me step_by_step how to download spring dependencies with Maven. I just spent whole day with absolutely no success.
PS. I have Java 1.5.06 and have already downloaded spring (with no dependencies) and i...
Like the title suggests, I am looking for a good read on Java application design that leverages Spring. When I read different examples on the internet or the Spring official documentation, I had this feeling that every author out there presumes that you are good with patterns. Buzz words like DAO, Singleton and etc are used a lot. As an ...
Hi,
I am using Spring to inject beans. And I am using some annotations to annotate bean methods (Security, TransactionManagement, ExceptionHanling, Logging). The problem is:
I want to create JUnit test to check if I forgot annotate some methods. But Spring returns $ProxyXXX class without any annotations on methods..
Method[] methods =...
I want to create a unit test for integration testing. What class should I inherit to be able to commit/rollback transactions? AbstractTransactionalSpringContextTests is deprecated. It's recommended to use AbstractJUnit38SpringContextTests instead, but I cannot find how to control transactions there.
...
If I have a web application that also services requests for iphone/android applications, what is the best way to go about designing the application?
i am using spring mvc.
Would it be possible (or advisable) to use the same controller action to service both web and mobile requests, or would I have to duplicate things with another set o...
I am using Java with Spring framework. Given the following url:
www.mydomain.com/contentitem/234
I need to map all requests that come to /contentitem/{numeric value} mapped to a given controller with the "numeric value" passed as a parameter to the controller.
Right now in my servlet container xml I have simple mappings similar to t...
I need to secure a simple jersey RESTful API in a Tomcat 6.0.24 container. I'd like to keep the authentication with Basic Authentication using the tomcat-users.xml file to define the users and roles (this is for now, like I said its small).
Now, for authorization I'd like to be able to use the JSR 250 annotations like @RolesAllowed, @Pe...
I use SecurityContextHolder and a custom UserDetailsService to obtain UserDetails from SecurityContextHolder:
Object o = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetailsDTO user = (UserDetailsDTO) o;
I left out the null checks, etc., but that's the idea. I'm using this in an @Around pointcut of an @A...
I used an older grails version, latest that was out in November 2009, and upgraded to 1.2.1 now. Unfortunately. I did not touch the app, checked it out of VCS. Now the spring injection does not work anymore.
I depend on external libraries (JmsTemplate, ActiveMQ, ...) and define all the beans in my resources.xml file. To test if spring i...
I have a web app running on a production server which does not allow public internet access. The initialization fails with error like
2010-02-18 15:21:33,150 **WARN** [SimpleSaxErrorHandler.java:47] Ignored XML validation warning
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'https://jax-ws.dev.java...
I am trying to create a RESTful controller using Spring 3.0. The controller is for a management API for a portal application. The operations I want to perform are:
GET /api/portals to list all the portals
POST /api/portals to create a new portal
GET /api/portals/{id} to retrieve an existing portal
PUT /api/portals/{id} to update an exi...
Why does the code below result in org.datanucleus.exceptions.NucleusUserException: Object Manager has been closed? The exception appears to be thrown at query.getResultList().
public final void removeUserTokens(final String username) {
final Query query = entityManager.createQuery(
"SELECT p FROM PersistentLogin p WHERE user...
Hi
I'm writing a DAO using spring and hibernate
public class DaoImpl extends HibernateDaoSupport implements Dao {}
For reading or updating data I'm using HQL getHibernateTemplate().bulkUpdate(...) but one of the queries is too complex for that and I need to use native SQL Query query = getSession().createSQLQuery(...)
But doing tha...
I'm currently experiencing problems with a JPATransactionManager in a J2SE application.
The latest request was not properly saved in the database (surely a problem of cache).
This seems to be normal because the exit of the program does not seem to "cleanly" exit all Bean of the spring application context.
Do you know if there's a meth...
I've a function updating database table using Spring's JdbcTemplate and for some reason there was exceptin that connection is read only u can not update any database related changes. How to resolve these problem?
...
Hi,
I want to load SQL script files for my unit tests. As I am using Spring 2.5.2, I decided to use the SimpleJdbcTestUtils.executeScript() method to load my script file, using the following code:
DriverManagerDataSource dataSource = ... // getting my DataSource defined in my Spring context
SimpleJdbcTemplate template = new SimpleJdbcT...
Hello,
I'm having a frustrating problem with my Grails application. I'm able to run the application using both run-app and run-war without any issues, but when I try to deploy to a container, I get an exception that I'm not sure how to interpret. I've tried deploying on Glassfish, Tomcat, and Jetty, and I have the same issue in all thre...