File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
spring-orm/src/main/java/org/springframework/orm/jpa/persistenceunit Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2017 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
package org .springframework .orm .jpa .persistenceunit ;
18
18
19
19
import jakarta .persistence .spi .ClassTransformer ;
20
+ import org .apache .commons .logging .LogFactory ;
20
21
21
22
import org .springframework .core .DecoratingClassLoader ;
22
23
import org .springframework .instrument .classloading .LoadTimeWeaver ;
@@ -79,10 +80,12 @@ public ClassLoader getClassLoader() {
79
80
*/
80
81
@ Override
81
82
public void addTransformer (ClassTransformer classTransformer ) {
82
- if (this .loadTimeWeaver == null ) {
83
- throw new IllegalStateException ("Cannot apply class transformer without LoadTimeWeaver specified" );
83
+ if (this .loadTimeWeaver != null ) {
84
+ this .loadTimeWeaver .addTransformer (new ClassFileTransformerAdapter (classTransformer ));
85
+ }
86
+ else {
87
+ LogFactory .getLog (getClass ()).info ("No LoadTimeWeaver setup: ignoring JPA class transformer" );
84
88
}
85
- this .loadTimeWeaver .addTransformer (new ClassFileTransformerAdapter (classTransformer ));
86
89
}
87
90
88
91
/**
You can’t perform that action at this time.
0 commit comments