Reputation: 1971
I've been struggling with this for a while and it's driving me crazy. Basically I've a bean defined as follows:
<bean id="tipoUfficioGiudiziarioListImpl" singleton="false"
class="java.util.ArrayList" >
</bean>
and it's basically a collectio of all the entries in a table. now the problem is that this bean is loaded when at server start up (or at first use if I set lazy-init="true"
) but if I add an entry on the db (both via the application itself or sql) the bean does not reload and I don't see the new entries when the collection is used.
is there any way to force this to reload or invalidate it so it'll be loaded at the next first use?
I'm using Spring 1.2
Upvotes: 0
Views: 1635
Reputation: 3
you can do like this:
@Aspect
@Component
public class DaoAspect {
@Autowired
TipoUfficioGiudiziarioListImpl impl;
//your dao path,intercept your dao operation.
@Before("execution(* com.test.dao..*.*(..))")
public void doBeforeInServiceLayer(JoinPoint joinPoint) {
/*
TODO some condition
*/
impl.loaddata();
}
}
Upvotes: 0
Reputation: 55
Maybe, you want to instantiate a new bean instance every time you use it, you can do this using prototype scope? <bean id = tipoUfficioGiudiziarioListImpl" class="java.util.ArrayList" scope = "prototype">
?
Upvotes: 1