Add proxyBeanMethods = false

It's slightly faster, and we don't need proxies in this app.
This commit is contained in:
Dave Syer 2019-11-20 10:21:30 +00:00
parent 2c98a681ca
commit 1561eb5506
2 changed files with 13 additions and 10 deletions

View file

@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author Dave Syer * @author Dave Syer
* *
*/ */
@SpringBootApplication @SpringBootApplication(proxyBeanMethods = false)
public class PetClinicApplication { public class PetClinicApplication {
public static void main(String[] args) { public static void main(String[] args) {

View file

@ -16,18 +16,19 @@
package org.springframework.samples.petclinic.system; package org.springframework.samples.petclinic.system;
import javax.cache.configuration.MutableConfiguration;
import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer; import org.springframework.boot.autoconfigure.cache.JCacheManagerCustomizer;
import org.springframework.cache.annotation.EnableCaching; import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import javax.cache.configuration.MutableConfiguration;
/** /**
* Cache configuration intended for caches providing the JCache API. This configuration creates the used cache for the * Cache configuration intended for caches providing the JCache API. This configuration
* application and enables statistics that become accessible via JMX. * creates the used cache for the application and enables statistics that become
* accessible via JMX.
*/ */
@Configuration @Configuration(proxyBeanMethods = false)
@EnableCaching @EnableCaching
class CacheConfiguration { class CacheConfiguration {
@ -39,11 +40,13 @@ class CacheConfiguration {
} }
/** /**
* Create a simple configuration that enable statistics via the JCache programmatic configuration API. * Create a simple configuration that enable statistics via the JCache programmatic
* configuration API.
* <p> * <p>
* Within the configuration object that is provided by the JCache API standard, there is only a very limited set of * Within the configuration object that is provided by the JCache API standard, there
* configuration options. The really relevant configuration options (like the size limit) must be set via a * is only a very limited set of configuration options. The really relevant
* configuration mechanism that is provided by the selected JCache implementation. * configuration options (like the size limit) must be set via a configuration
* mechanism that is provided by the selected JCache implementation.
*/ */
private javax.cache.configuration.Configuration<Object, Object> cacheConfiguration() { private javax.cache.configuration.Configuration<Object, Object> cacheConfiguration() {
return new MutableConfiguration<>().setStatisticsEnabled(true); return new MutableConfiguration<>().setStatisticsEnabled(true);