setting the spring bean at application level and accessing the same on jsp
How can I set a spring bean at application level (declaratively)and use the member of it on jsp ? ...
How can I set a spring bean at application level (declaratively)and use the member of it on jsp ? ...
I used to design my application around anemic domain model, so I had many repository object, which were injected to the big, fat, transaction-aware service layer. This pattern is called Transaction script. It's not considered a good practice since it leads to the procedural code, so I wanted to move forward to the domain driven design. ...
I use Struts2 and my application has thousands of action classes managed by Spring. I used Spring 2.5.6 before and my application starts quickly. But when I changed Spring to 3.0. I got a extremely slow start up of Tomcat. For each action class, I got the following debug message from Spring: DEBUG (Cglib2AopProxy.java:802) - Unable to a...
I'm porting a class from plain JDBC to use Spring. Part of this class consists of a block that find the most recent row, updates a field, and selects it into an object to be processed later. This block should only be executed by one thread on one machine at a time to make sure no two threads process the same row. We've been handling mu...
I am reading and write XML over a TCP connection (not HTTP) as part of a web service I'm developing, and I was wondering whether there is a more "springified" way (or even other ideas) of achieving what I'm trying below: InputStream is = null; OutputStream os = null; Socket s = null; try { s = new Socket(address,...
I think im confused a bit about session annotation in spring mvc. I have code like this (2 steps form sample, step 1 user data, step 2 address) @SessionAttributes({"user", "address"}) public class UserFormController { @RequestMapping(method = RequestMethod.GET) public ModelAndView show( ModelAndView mv ){ mv.addObject(...
Is it possible to add a property from PropertyPlaceholder to a bean via @Autowired? I can't inject it in the xml-context-config because the beans are loaded this way: <context:component-scan base-package="..."/> ...
I'm trying to go over each row of a table in MySQL using Spring and a JdbcTemplate. If I'm not mistaken this should be as simple as: JdbcTemplate template = new JdbcTemplate(datasource); template.setFetchSize(1); // template.setFetchSize(Integer.MIN_VALUE) does not work either template.query("SELECT * FROM cdr", new RowCall...
Hi all, To avoid XA overhead I prefixed some table names from project A and rolled it out to be inside the same mysql database as project B so I can use the same connection - and hope to get full atomicity etc. Project A and B though have very different session factory configs. I have a HibernateTransactionManager configured for projec...
Looking at springs sample application petcare. The patient controller looks like: package org.springframework.samples.petcare.clients.patients; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.sprin...
I downloaded spring's petcare application from their svn repository. How do I go about loading in an editor and running it? It has a pom.xml file, and I see references to eclipse. I downloaded eclipse, but I guess I need some sort of plugin to open it? Is there a readme file that I missed that details on how to run this sample appl...
<bean id="ntlmFilter" class="org.springframework.security.ui.ntlm.NtlmProcessingFilter"> <security:custom-filter position="NTLM_FILTER" /> <property name="stripDomain" value="true" /> <property name="defaultDomain" value="company" /> <property name="domainController" value="192.168.1.1" /> <property name="authenticati...
Hello, I want set an extra cookie after user login successful. after read the source code of AbstractProcessingFilter, I found that it fire an InteractiveAuthenticationSuccessEvent after login. so I can write an ApplicationEventListener for this, but how can I get the corresponding HttpServletResponse in the event listener? thanks. ...
Hello, I have a basic doubt in how to proceed in my application. I have a form and I need to validate that all the inputs which are numbers. I have a problem in deciding the type of the attributes of the bean asociated with the form. I don't know if setting them to String or to double and here are the reasons: If I set them to double:...
<bean id="data.emf" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean" > <property name="persistenceUnitName" value="transactions-optional" /> </bean> from what i know by default all bean are singleton (according to document) but i somehow still getting duplicated creating of entitymanagerfactory. is there any p...
Hi I am using Spring JdbcTemplate with the DAO pattern to access a database. Instead of creating the database tables manually, I am looking for a way to generate the tables in the DAO layer. I understand that I can use the jdbcTemplate to execute statements, I am only looking for the right place to do it. Is there a best practice for...
I'm trying to use JPA 2.0 in Spring 3.0 ORM. The JPA vendor is Hibernate 3.5.0-Beta-3. It works well with JPQL, but when I tried to use CriteriaQuery, an exception happens: java.lang.ClassCastException: $Proxy50 cannot be cast to javax.persistence.TypedQuery at $Proxy38.createQuery(Unknown Source) at com.absorbx.re...
Scenario: In my application (which utilises an rich domain model, where the logic is in the model, not in the services) I have users. I create new users with a service User newUser = userService.createNewUser("Hans Dampf"); or get them from the database User oldUser = userDao.findByName("Hans Dampf"); Because in every call into my...
I have a cluster of servers running a spring application. Some of the spring components need to be configured differently depending on the role their server is playing (primary, secondary, etc). I don't want to maintain separate spring config files for each role, rather I want to dynamically detect this when the application is started....
Does anyone know how what Spring Jdbc template method I could use to execute this 'upsert' or an alternative approach that would also perform the operations in one database call? UPDATE jasper_report SET Uri = 'update' WHERE ReportId = 99; IF @@ROWCOUNT = 0 AND Exists(Select 1 FROM report Where Id = 99) BEGIN INSERT INTO jasper_r...