Announcement Announcement Module
No announcement yet.
Can you apply aspects to a spring test? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Can you apply aspects to a spring test?

    If you have a spring test
    public class MyTransactionSpringTest {
       public void testSomething() {
    Can you apply aspects to it? For example, if you did not want to apply the @Transactional annotation on the test method (or class) but instead wanted to apply them in an aspect.

    Thanks in advance.

  • #2
    Your question is a bit confusing, I don't understand what you're really trying to do. Anyway, you can't apply aspects on a JUnit test class, but the aspects you defined in your test application context DO get applied to your Spring beans, even when running JUnit tests (we are talking about Spring AOP here, AspectJ needs some configuration to be set up to run with JUnit).