我尝试进行切入点,以记录SQL查询
@Before("execution(* org.springframework.jdbc.core.JdbcTemplate.*(String, ..))")
public void logSQLQueries() {
System.out.println("@@");
}
Run Code Online (Sandbox Code Playgroud)
但我明白了
java.lang.IllegalArgumentException: Can not set org.springframework.jdbc.core.JdbcTemplate field com.xyz.abc.dao.ABCDaoImpl.jdbcTemplate to com.sun.proxy.$Proxy53
Run Code Online (Sandbox Code Playgroud)
我在我的*-servlet.xml中创建了jdbcTemplate bean,并在我所有的DAO中自动启用了它.工作得非常好,但添加切入点会产生异常.有任何想法吗 ??
我正在尝试以下代码:http://www.dineshonjava.com/2012/12/spring-mvc-with-hibernate-crud-example.html#.Uus0bvnoSGc sdnext-servlet.xml如下
<beans xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xsi:schemalocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
<context:property-placeholder location="classpath:resources/database.properties">
</context:property-placeholder>
<context:component-scan base-package="com.dineshonjava">
</context:component-scan>
<tx:annotation-driven transaction-manager="hibernateTransactionManager">
</tx:annotation-driven>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" id="jspViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource" id="dataSource">
<property name="driverClassName" value="${database.driver}"></property>
<property name="url" value="${database.url}"></property>
<property name="username" value="${database.user}"></property>
<property name="password" value="${database.password}"></property>
</bean>
<bean class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" id="sessionFactory">
<property name="dataSource" ref="dataSource"></property>
<property name="annotatedClasses">
<list>
<value>com.dineshonjava.model.Employee</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto} </prop>
</props>
</property>
</bean> …Run Code Online (Sandbox Code Playgroud) 我试图使用JPA与Spring MVC,mySql.我从这里了解JPA和Hibernate有什么区别?JPA可以单独使用,但是大多数Web资源都将其描述为仅需要实现的规范.那么我可以在没有EclipseLink,Hibernate等持久性提供程序的情况下使用JPA,如果是,那么如何?
我需要重定向到另一个页面上点击提交并调用一个函数进行ajax调用.这就是我所拥有的:
$('#submitButton').click(function() {
window.location.href = "otherPage";
displayData();
});
Run Code Online (Sandbox Code Playgroud)
另外,我尝试的另一种方法是使用在otherPage上设置表单字段
var elem = window.document.getElementById(field);
elem.value = "new-value";
Run Code Online (Sandbox Code Playgroud)
这样我就可以在otherPage上调用提交按钮的事件处理程序,但它不起作用.请让我知道我错在哪里.
spring ×2
spring-mvc ×2
aspectj ×1
hibernate ×1
java ×1
javascript ×1
jpa ×1
jquery ×1
mysql ×1
persistence ×1
proxy ×1
spring-aop ×1
xml ×1