spring-3

How to use property from property file specified in PropertyPlaceholderConfigurer in JSP

两盒软妹~` 提交于 2019-11-26 19:53:15
问题 In my application context I have defined properties file: <context:property-placeholder location="classpath:application.properties" /> I want to get value of the property defined in that file on JSP page. Is there a way to do that in the way ${something.myProperty}? 回答1: PropertyPlaceholderConfigurer can only parse placeholders in Spring configuration (XML or annotations). Is very common in Spring applications use a Properties bean. You can access it from your view this way (assuming you are

Benefits of JavaConfig over XML configurations in Spring?

删除回忆录丶 提交于 2019-11-26 19:49:13
问题 Earlier the configurations used to be in hard coded in the code, later it was externalized to .property files (for sake of avoiding hard coded values, avoiding changing code for the sake of changing configurations..etc) then it moved to XML (for sake of being more standardized, error free..etc) Now, while reading about @Configuration in Spring 3 , looks like we are again moving back to the initial approach. Why would we want to hard-code configurations in the code rather than having it

eventlisteners using hibernate 4.0 with spring 3.1.0.release?

本秂侑毒 提交于 2019-11-26 18:50:26
These jars are both new released and have the latest solutions for Java EE applications. But I have a problem on specifiying hibernate listeners in hibernate.cfg.xml. Before spring 3.1.0, LocalSessionFactroyBean was holding an attribute that keeps eventlisteners. But with 3.1.0.release there is no eventlisteners map. Now I fail keeping the track of modal objects on saveorupdate, postload etc. because they are not configured by Spring. Do you have an idea to solve this issue? nano I had the same frustrating problem. Hibernate 4 appears to have fundamentally changed the way you register for

No Session found for current thread (Spring 3.1.X and Hibernate 4)

非 Y 不嫁゛ 提交于 2019-11-26 16:16:12
问题 I'm trying to set up my project using Spring 3.1 and Hibernate 4. I've been following some tutorials online. I'm getting a strange error that according to the spring forums should have been fixed with Spring 3.1. Spring Bug Tracker When my service calls getCurrentSession() , it throws the following exception: org.hibernate.HibernateException: **No Session found for current thread**] with root cause org.hibernate.HibernateException: No Session found for current thread at org.springframework

determine target url based on roles in spring security 3.1

时间秒杀一切 提交于 2019-11-26 16:10:11
问题 In spring security 3.0, we are having AuthenticationProcessingFilter class, in which we were using determineTargetUrl() method, which returned the url based on different roles. Now, we are moving to spring security 3.1.0.RC3 and I am stuck how should I now determine the url based on different roles as AuthenticationProcessingFilter class has been removed from new version. Can anyone please give me steps in brief with some code so that I can implement custom filter to redirect to different

difference between @Component and @Configuration in Spring 3

非 Y 不嫁゛ 提交于 2019-11-26 15:58:23
问题 I came across two annotations provided by Spring 3 (@Component and @Configuration) I am a bit confused between these. Here is what I read about @Component Put this “context:component” in bean configuration file, it means, enable auto scanning feature in Spring. The base-package is indicate where are your components stored, Spring will scan this folder and find out the bean (annotated with @Component) and register it in Spring container. So I am wondering what is the use of @Configuration then

What&#39;s the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?

社会主义新天地 提交于 2019-11-26 14:49:26
I am migrating from Spring 2.5 to Spring 3. They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only. In Spring 2.5 I have just used <context:annotation-config /> and <context:component-scan base='...'/> tags declared both in application-context.xml and dispatcher servlet configuration XML with appropriate base packages to scan. So I wonder what is the difference between mvc:annotation-driven and context:annotation-config tags in servlet config and what can I eliminate in Spring 3 config files? skaffman

How to register Spring @Configuration annotated class instead of applicationContext.xml file in web.xml?

淺唱寂寞╮ 提交于 2019-11-26 07:53:32
问题 I am using jsf and spring together in web application. I have configured datasource and session factory in one configuration class which uses annotations like @Configuration, @ComponentScan etc. I don\'t have any applicationContext.xml file in my project as I am handling every entry of context xml in Configuration class. The test case works successfully but when I deploy my web application, it gives me error java.lang.IllegalStateException: No WebApplicationContext found: no

eventlisteners using hibernate 4.0 with spring 3.1.0.release?

早过忘川 提交于 2019-11-26 06:38:33
问题 These jars are both new released and have the latest solutions for Java EE applications. But I have a problem on specifiying hibernate listeners in hibernate.cfg.xml. Before spring 3.1.0, LocalSessionFactroyBean was holding an attribute that keeps eventlisteners. But with 3.1.0.release there is no eventlisteners map. Now I fail keeping the track of modal objects on saveorupdate, postload etc. because they are not configured by Spring. Do you have an idea to solve this issue? 回答1: I had the

What&#39;s the difference between <mvc:annotation-driven /> and <context:annotation-config /> in servlet?

丶灬走出姿态 提交于 2019-11-26 04:04:21
问题 I am migrating from Spring 2.5 to Spring 3. They have introduced <mvc:annotation-driven /> which does some black magic. This is expected to be declared in servlet configuration file only. In Spring 2.5 I have just used <context:annotation-config /> and <context:component-scan base=\'...\'/> tags declared both in application-context.xml and dispatcher servlet configuration XML with appropriate base packages to scan. So I wonder what is the difference between mvc:annotation-driven and context