spring-3

How to perform logout programmatically in spring 3

隐身守侯 提交于 2019-12-10 01:20:50
问题 I have a spring configuration for logout like follows: <logout logout-url="/abc/logout" logout-success-url="/abc/login"/> Now I want to do programmatically logout. How I can achieve this in Spring 3. I need to do logout from one of my controller which has the following def. and currently I am doing something like following...Is this a good idea.. public void suppressUserProfile() { //... return "redirect:/abc/logout"; } 回答1: It depends. If it's ok for your app to place the logged out user on

How to pool objects in Spring?

烈酒焚心 提交于 2019-12-09 18:14:36
问题 I'm following this tutorial regarding how to pool objects in Spring. I've followed the instruction written on the tutorial but when I run my application, it always generates a new instance of the object. I'm expecting that since I'm pooling the objects, existing objects will be reuse. As such, no new instances should be created. Also, when I access of the getter method of the bean, a new instance of the bean is created again. What could have I done wrong? Did I misunderstood the concept of

Spring Conversion Service: how to convert String to List<MyType>?

泪湿孤枕 提交于 2019-12-09 10:07:10
问题 I am using Spring's Conversion Service, and have my own converter registered with it: public class MyTypeConverter implements Converter<String, MyType> { @Override public Currency convert(String text) { MyType object = new MyType(); // do some more work here... return object; } } Now in my application I can do conversion from String to MyType and it works well: @Autowired private ConversionService cs; public void doIt() { MyType object = cs.convert("Value1", MyType.class); } But I also

Spring 3.0.6 MVC @PathVariable and @RequestParam blank/empty in JSP view

吃可爱长大的小学妹 提交于 2019-12-09 09:20:40
问题 I have been trying to get an incredibly simple controller/view set up, and just can't make it work. In my web.xml , I've defined a <servlet> called servlet-context.xml , which is running ok. In servlet-context.xml , I've set: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" <...other stuff in here... /> <mvc:annotation-driven /> among other things. My understanding is this is all that's

Spring 3 ,with Java based configuration, and Resources access issue

北慕城南 提交于 2019-12-09 03:11:55
问题 I am using Spring 3 ,java based configuration, with BootStrap. I have downloaded the bootstrap and put the css and js under resources directory. The issue that I cann't use these .css from within the freemarker page. Howeve that I imported them. As I am using the java based configuration,I have added the "addResourceHandler" as follows: WebAppConfig: @Configuration @EnableWebMvc @ComponentScan("com.springway") public class WebConfig implements WebApplicationInitializer { @Override public void

Spring 3 Request processing failed; nested exception is java.lang.NullPointerException

给你一囗甜甜゛ 提交于 2019-12-09 01:55:37
问题 I am having difficulties while trying to launch my app, i looked for my mistake for a couple of days but i am stuck somewhere in the code and asking for your assistance Thanks SingleTransactionsController @Controller public class SingleTransactionsController { private SingleTransactionsService singleTransactionsService; @RequestMapping(value="/disableUser/{sicil}", method=RequestMethod.GET) public String disableUser(@PathVariable String sicil, Model model){ singleTransactionsService

Spring Security; custom-filter and user-service-ref not working together

雨燕双飞 提交于 2019-12-08 10:15:50
问题 I'm trying to implement spring security authorization using a custom filter. security.xml <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www

Can DTOs be spring managed beans? [closed]

不羁岁月 提交于 2019-12-08 08:30:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am using spring 3.0. I have few DTOs. Can I declare them as spring beans? If so what should be the bean scope? 回答1: Usually, DTOs instantiation is not managed by spring (for instance Hibernate often instantiates DTOs). Spring does have a prototype scope where a new object is

does spring 3.2 require servlet 3.0 or it works with servlet 2.5

北城余情 提交于 2019-12-08 07:43:07
问题 I am using spring 3.2.4 in my application but some of the features are not working properly like @controllerAdvice. I know that it is a feature added in spring 3.2. I am using servlet 2.5.I googled about spring 3.2 and found that The Spring MVC programming model now provides explicit Servlet 3 async support. Kindly tell me does spring 3.2 works with servlet 2.5 or not? 回答1: Spring 3.2 should work with Servlet 2.5 API. Only Spring 4.0 requires Serlvet 3.0: (http://docs.spring.io/spring/docs

Could not open JPA EntityManager for transaction; org.hibernate.exception.GenericJDBCException: Could not open connection

无人久伴 提交于 2019-12-08 05:34:19
问题 I am working on spring hibernate with jpa specification when my web application try to connect to database it gives the above exception Caused by: java.sql.SQLException: Access denied for user 'sandip'@'localhost' (using password: YES) , sandip is my linux user. data source set is like....... @Bean public DataSource getDataSource() { DriverManagerDataSource ds = new DriverManagerDataSource( env.getProperty("url")); ds.setDriverClassName(env.getProperty("driver")); ds.setUsername(env