当我尝试使用时:
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/autonumeric@4.5.1/dist/autoNumeric.min.js"></script>
<p><strong>Automatic decimalisation</strong> is applied if there is only a single character divider added to input. </p>
<p>Attributes needed in the inputs include:<p>
<ul>
<li>currency - i.e. 'British', 'Turkish'</li>
<li>currency-divider - i.e. '.' or ',' or ',.'</li>
</ul>
<hr>
<div class="currency-wrapper">
<label>Turkish ₺</label>
<input type="text" name="currency" id="currencyTurkish" currency-divider="," currency="Turkish">
<span class="value_currency"></span>
</div>
<hr>
<div class="currency-wrapper">
<label>Turkish ₺ (divider set as comma and decimal)</label>
<input type="text" name="currency" id="currencyTurkishDouble" currency-divider=".," currency="Turkish">
<span class="value_currency"></span>
</div>
<hr>
<div class="currency-wrapper">
<label>British £</label>
<input type="text" name="currency" id="currencyBritish" currency-divider="." currency="British">
<span class="value_currency"></span>
</div>
<hr>
<div class="currency-wrapper">
<label>British £ (no divider set)</label>
<input type="text" name="currency" id="currencyBritishNoDivider" currency-divider="" currency="British">
<span class="value_currency"></span>
</div>
交易无效,但如果我使用
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
一切正常。
我的代码:
SpringBootAplication
@EnableTransactionManagement(mode = AdviceMode.PROXY)
控制器
@SpringBootApplication
@EnableScheduling
@EnableTransactionManagement(mode = AdviceMode.ASPECTJ)
@EnableLoadTimeWeaving(aspectjWeaving = EnableLoadTimeWeaving.AspectJWeaving.ENABLED)
public class SpringBootAplication
{
private static ConfigurableApplicationContext applicationContext;
public static void main(String[] args)
{ System.out.println(InstrumentationLoadTimeWeaver.isInstrumentationAvailable());
applicationContext = SpringApplication.run(SpringBootAplication.class, args);
}
我还有一个VM选项:-javaagent:ASPECTJ的“ spring-instrument-5.1.2.RELEASE.jar”。
这是我在尝试进行当前交易时所接受的例外情况。
@RestController
public class MyController
{
@Autowired
MyRepository repository;
@Transactional
@RequestMapping(value = "/", method = RequestMethod.GET)
public void test()
{
repository.findById("name");
System.out.println(TransactionAspectSupport.currentTransactionStatus());
}
}
也是我的依赖
org.springframework.transaction.NoTransactionException: No transaction aspect-managed TransactionStatus in scope
答案 0 :(得分:0)
添加aspectjweaver.jar
代理,例如:-javaagent:/path/to/aspectjweaver.jar
应该可以解决您的问题。