I would not do this inside the method which is annotated with @Transactional. Have your @Service class do the database operation inside a method annotated with @Transactional. Then, create a...
Type: Posts; User: dominic_veit; Keyword(s):
I would not do this inside the method which is annotated with @Transactional. Have your @Service class do the database operation inside a method annotated with @Transactional. Then, create a...
Plus, do not expect that it will pass those properties TO the init-method. The way you have it, your class would need to look like this...
class TPMonitor {
public...
Depends-on should be rarely necessary, Spring is supposed to figure these dependencies out most of the time. Sort of backs up my init-method theory.
I think the problem is the use of init-method, Spring may not resolve these, until after all beans are created. So, depends-on may not care, because the bean has been constructed, but not...
Can you share little more code? How does the wiring work? Autowiring or explicit bean-refs?
You say that the second bean indirectly calls the first. Any way to make this direct?
...
Rather, the method that uses it should not be static in the first place. Don't fix it by declaring the variable static, fix it by making the method non-static.
It should not be a static field. If it must be static, then you would have to @Autowire a non-static setter, but have it set the static field. But this is dumb. The bean that contains the...
Looking at this more carefully...
The jee:jndi-lookup allows you to control whether or not the JNDI lookup occurs on startup or not with the lookup-on-startup property. Also, you can control...
I think , refactor it, you gotta close your statements and result sets.
Also commons-logging-1.1.1.jar
Dont put more than one version of a jar on the classpath. The results will not be predictable. You just have to find the config that works.
I struggled with this initially as well, I think...
If you have 6 appservers, each with a connection pool of 10, and you have 250 requests come in, the load balancer should send on average 250/6=41.6 requests to each appserver. Lets call it 40. ...
If you are manually coding JDBC now, and are using database transactions properly (autocommit = false, try - con.commit(), catch - con.rollback, and finally - con.close()) Then you are already...
I have found that the JNDI lookup on a jee:jndi-lookup does not occur on container load, but on each execution, and this saves the day. So, the datasource bean will live in the EAR context, but it...
Yea that is what it is doing, the connection is for the life of the thread. Thus ThreadLocal... but, the strategy that it uses will be based upon the exact TransactionManager implementation that is...
To answer it more directly, without a TransactionManager, there is no place for Spring to 'cache' shared connections. It doesnt blow up, but each subsequent call to...
What I have found, is that if you forget to define a transaction manager, or forget to put a @Transactional annotation, then DataSourceUtils.doGetConnection(dataSource) will always get a new...
I have read the following very helpful posts about setting up a parent EAR context that can be shared between WARs. My question is about how best to set up datasources under such a config (for...