spring-3

How update/remove an item already cached within a collection of items

六月ゝ 毕业季﹏ 提交于 2019-12-21 04:13:29
问题 I am working with Spring and EhCache I have the following method @Override @Cacheable(value="products", key="#root.target.PRODUCTS") public Set<Product> findAll() { return new LinkedHashSet<>(this.productRepository.findAll()); } I have other methods working with @Cacheable and @CachePut and @CacheEvict. Now, imagine the database returns 100 products and they are cached through key="#root.target.PRODUCTS" , then other method would insert - update - deleted an item into the database. Therefore

How update/remove an item already cached within a collection of items

元气小坏坏 提交于 2019-12-21 04:13:03
问题 I am working with Spring and EhCache I have the following method @Override @Cacheable(value="products", key="#root.target.PRODUCTS") public Set<Product> findAll() { return new LinkedHashSet<>(this.productRepository.findAll()); } I have other methods working with @Cacheable and @CachePut and @CacheEvict. Now, imagine the database returns 100 products and they are cached through key="#root.target.PRODUCTS" , then other method would insert - update - deleted an item into the database. Therefore

Spring bean instantiation by passing constructor args? [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-21 03:49:07
问题 This question already has answers here : Passing values to spring bean programmatically? (1 answer) How to Instantiate spring bean with in a method with runtime constructor arguments? (1 answer) Closed 5 years ago . I have below spring bean. public class Employee2 { private int id; private String name; private double salary; public Employee2(int id, String name, double salary) { this.id = id; this.name = name; this.salary = salary; } // some logic to call database using above values } Now i

HttpMediaTypeNotAcceptableException after upgrading to Spring 3.2

跟風遠走 提交于 2019-12-21 00:13:31
问题 After upgrading my Spring MVC application to Spring 3.2 I'm getting the following exception when accessing some of my URLs: org.springframework.web.HttpMediaTypeNotAcceptableException: Could not find acceptable representation at org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping.handleNoMatch(RequestMappingInfoHandlerMapping.java:203) ~[spring-webmvc-3.2.0.RELEASE.jar:3.2.0.RELEASE] at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping

Upgrading to springframework.scheduling.concurrent?

老子叫甜甜 提交于 2019-12-20 18:39:33
问题 As of Spring 3.0 the ScheduledTimerTask is deprecated and I can't understand how to upgrade to org.springframework.scheduling.concurrent. <bean id="timerFactoryBean" class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <ref bean="onlineTimeSchedule" /> </list> </property> </bean> <bean id="onlineTimeSchedule" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <property name="timerTask" class="com.example.OnlineTimerTask" />

Upgrading to springframework.scheduling.concurrent?

烈酒焚心 提交于 2019-12-20 18:39:14
问题 As of Spring 3.0 the ScheduledTimerTask is deprecated and I can't understand how to upgrade to org.springframework.scheduling.concurrent. <bean id="timerFactoryBean" class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <ref bean="onlineTimeSchedule" /> </list> </property> </bean> <bean id="onlineTimeSchedule" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <property name="timerTask" class="com.example.OnlineTimerTask" />

Can't get Spring MVC dispatcher to work properly when url pattern is a path

限于喜欢 提交于 2019-12-20 14:13:02
问题 I have a web app that we're applying spring MVC just for REST services at the moment. We want our rest services to appear under ${contextPath}/rest/** , however when I set this we get: No mapping found for HTTP request with URI [/myapp/rest/testSvc/message] in DispatcherServlet with name 'Spring MVC Dispatcher Servlet' My web.xml has: <servlet> <servlet-name>Spring MVC Dispatcher Servlet</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init

@Autowired beans not loading after using beans:profiles in spring 3.1

那年仲夏 提交于 2019-12-20 03:52:20
问题 I have used beans:profiles in my xml like this: <beans profile="dev"> <bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.internal.url}" /> <property name="username" value="${jdbc.internal.username}" /> </bean> </beans> I've set the spring.active.profiles in web.xml: <servlet> <servlet-name>myapp</servlet-name> <servlet-class>org.springframework.web

Spring throws the error: Bean definition is abstract

大城市里の小女人 提交于 2019-12-20 01:11:19
问题 I need some help with next topic. I have a hierarchy of beans, just like that: <bean id="father" class="myPackage.Father" abstract="true"/> <bean id="childA" class="myPackage.ChildA" parent="father"> <property name="atrib1" value="hello"></property> </bean> <bean id="childB" class="myPackage.ChildB" parent="father"> <property name="atrib2" value="bye"></property> <property name="atrib3" value="other"></property> </bean> I need to create another bean which contains a reference to the abstract

How do I get unit test to run in java 7: java.lang.VerifyError: Expecting a stackmap frame at branch target

安稳与你 提交于 2019-12-19 05:16:19
问题 Hi I am running a maven test using maven 3.0.3 with hibernate 4.0.0 Final release and spring 3.1 on jdk7 update 2. I get the following error. Caused by: java.lang.VerifyError: Expecting a stackmap frame at branch target 63 in method ${myDomainClass}.equals(Ljava/lang/Object;)Z at offset 24 at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) at java.lang.Class.getDeclaredMethods(Class.java:1808) at org.hibernate.property