我正在使用基于注释的声明方法来实现spring aop.示例代码
ClassA{
@Transactional(readOnly = false, propagation = Propagation.REQUIRES_NEW)
add()
{
method1();
method2();
method3();
}
}
Run Code Online (Sandbox Code Playgroud)
但我仍然怀疑使用传播.传播.Requires_New意味着每个请求都将启动新事务.
第二个问题:
是不是像method2,method3这样的方法失败会导致事务回滚?
如果有任何可以帮助我倾斜交易传播,我将非常高兴.
有人可以为我提供一个真实世界的例子,我们需要参与现有的交易.因为我想象我们在上面的例子中使用的添加功能将对所有用户独立,或者任何其他功能将独立于每个正在呼叫的用户.我无法找到使用PROPAGATION_SUPPORTS,PROPAGATION_MANDATORY,PROPAGATION_REQUIRES_NEW等其他传播行为的示例
我们如何记录spring transaction机制.我将在下面的示例中显示Spring Doc sec 10.5.2中显示的示例.如果我想记录到这个级别如何做到这一点
我正在使用Spring,Hibernate和Log4j.
<!-- the Spring container is starting up... -->
[AspectJInvocationContextExposingAdvisorAutoProxyCreator] - Creating implicit proxy
for bean 'fooService' with 0 common interceptors and 1 specific interceptors
<!-- the DefaultFooService is actually proxied -->
[JdkDynamicAopProxy] - Creating JDK dynamic proxy for [x.y.service.DefaultFooService]
<!-- ... the insertFoo(..) method is now being invoked on the proxy -->
[TransactionInterceptor] - Getting transaction for x.y.service.FooService.insertFoo
<!-- the transactional advice kicks in here... -->
[DataSourceTransactionManager] - Creating new transaction with …Run Code Online (Sandbox Code Playgroud) 我们在Spring源工具套件中使用Aspectj编译时加载..当我们尝试在websphere服务器上部署这个项目时,我们得到了以下异常.这个项目在tomcat服务器上工作得很好..库存在一些问题AspectJ编译器已经存在于Spring Source Tool中.
Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions
(1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException:
Property 'exceptionProp' threw exception; nested exception is java.lang.NoSuchMethodError: org/aspectj/runtime/internal/AroundClosure.linkClosureAndJoinPoint(I)
Lorg/aspectj/lang/ProceedingJoinPoint
Run Code Online (Sandbox Code Playgroud) 我试图使用3.1弹簧缓存配置和命名空间按照春季文档.我也从春季网站下载了最新的jar,但我仍然遇到有关命名空间的问题
Unable to locate Spring NamespaceHandler for element 'cache:annotation-driven' of schema namespace 'http://www.springframework.org/
Run Code Online (Sandbox Code Playgroud)
模式/高速缓存"
spring配置文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd">
cache:annotation-driven />
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager" p:cache-manager-ref="ehcache"/>
<bean id="ehcache" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
p:config-location="classpath:ehcache.xml"/>
Run Code Online (Sandbox Code Playgroud) 我们是grails的新手,并担心以下问题:
可扩展性问题
对不同的应用程序使用相同的后端
所以坚持单个grails是个好主意,或者我们应该分开关注点,甚至使用其他框架如node.js来使用rest来实现前端.
其次我不是很清楚,我们应该把业务逻辑放在grail app.Ideal place应该是我想的服务
我们正在检查Angular.js,因为它似乎比gsp页面更快,前端的当前风格和与grail的集成也更容易.想要检查是否是正确的选项.
我想根据属性file.how的请求获取特定值来做到这一点?
我有以下spring配置.我想根据请求设置Exprops的值,并从属性文件中获取相应的值
<bean id="Prop" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<value>classpath:ErrorMessage.properties</value>
</property>
</bean>
<bean id="PropertiesBean" class="com.util.PropertiesUtil">
<property name="Exprops" value="${EXampleExceptiion}"></property>
</bean>
Run Code Online (Sandbox Code Playgroud) 我在Eclipse Keplar中使用TestNG.我按照这里提供的确切步骤安装Eclipse的TestNG插件.安装成功.
当我尝试运行TestNG testsuite时,我收到错误
[testng] Unknown option: -serport'
Run Code Online (Sandbox Code Playgroud)
如何从Eclipse的Run As TestNG test菜单中删除此选项或编辑Eclipse的配置文件以从中删除此选项Run as TestNG test?
堆栈跟踪
Exception in thread "main" com.beust.jcommander.ParameterException: Unknown option: -serport
at com.beust.jcommander.JCommander.parseValues(JCommander.java:742)
Run Code Online (Sandbox Code Playgroud) spring ×5
java ×2
angularjs ×1
architecture ×1
aspectj ×1
caching ×1
eclipse ×1
grails ×1
grails-orm ×1
java-ee ×1
logging ×1
node.js ×1
properties ×1
spring-aop ×1
testng ×1
transactions ×1
websphere ×1