profile
viewpoint
Stéphane Nicoll snicoll VMware, Inc. Liège, Belgium https://about.me/snicoll Stéphane works on Spring Boot, Spring Framework & start.spring.io at VMware.

bclozel/spring-boot-web-reactive 170

DEPRECATED: Spring Boot Web Reactive Starter

openzipkin/sleuth-webmvc-example 149

See how much time Spring Boot services spend on an http request.

mstahv/spring-data-vaadin-crud 98

A super simple single table CRUD example with Spring Data JPA and Vaadin.

microsoft/spring-data-cosmosdb 88

Access data with Azure Cosmos DB

sbrannen/spring-composed 83

Composed annotations for use with the Spring Framework

snicoll/cfp-example 58

Sample app for the "10 ways to get super-productive with Spring Boot" talk

bclozel/initializr-stats 15

Companion apps for the Spring Boot 2.0 Web Apps talk

push eventspring-io/start.spring.io

Stephane Nicoll

commit sha bb9f056cf7c4339235cc7542457f8325ff2da9dd

Upgrade to Azure Spring 2.3.5 Closes gh-534

view details

push time in 2 hours

push eventsnicoll/spring-boot

Stephane Nicoll

commit sha 74533d938bd1b0de817ab2ad281bd5298a722822

Hacking See gh-23480

view details

push time in 3 hours

push eventsnicoll/spring-boot

Stephane Nicoll

commit sha 32a146ace9ca857c4542f8132f64654500b08204

Hacking See gh-23480

view details

push time in 3 hours

push eventsnicoll/spring-boot

Stephane Nicoll

commit sha f4cfa28d42f1c43404e2b8726a584c9ac92c4b2b

Hacking See gh-23480

view details

push time in 4 hours

push eventsnicoll/spring-boot

Stephane Nicoll

commit sha df5c36315c1b2342b25d218caf174bb0ea92bd54

Hacking See gh-23480

view details

push time in 4 hours

push eventsnicoll/spring-boot

Stephane Nicoll

commit sha 67aff5c1a9709b74fa6a012ca7822c916908e103

Hacking See gh-23480

view details

push time in 6 hours

issue closedspring-projects/spring-boot

Spring Boot 2.3.4.RELEASE not published on SDKMAN

~% sdk update

No new candidates found at this time.
~% sdk ls springboot 
================================================================================
Available Springboot Versions
================================================================================
 > * 2.3.3.RELEASE       2.1.3.RELEASE       1.5.9.RELEASE       1.2.7.RELEASE  
     2.3.2.RELEASE       2.1.2.RELEASE       1.5.8.RELEASE       1.2.6.RELEASE  
     2.3.1.RELEASE       2.1.1.RELEASE       1.5.7.RELEASE       1.2.5.RELEASE  
     2.3.0.RELEASE       2.1.0.RELEASE       1.5.6.RELEASE       1.2.4.RELEASE  
     2.2.9.RELEASE       2.0.9.RELEASE       1.5.5.RELEASE       1.2.3.RELEASE  
     2.2.8.RELEASE       2.0.8.RELEASE       1.5.4.RELEASE       1.2.2.RELEASE  
     2.2.7.RELEASE       2.0.7.RELEASE       1.5.3.RELEASE       1.2.1.RELEASE  
     2.2.6.RELEASE       2.0.6.RELEASE       1.5.2.RELEASE       1.2.0.RELEASE  
     2.2.5.RELEASE       2.0.5.RELEASE       1.5.1.RELEASE       1.1.12.RELEASE 
     2.2.4.RELEASE       2.0.4.RELEASE       1.4.7.RELEASE       1.1.11.RELEASE 
     2.2.3.RELEASE       2.0.3.RELEASE       1.4.6.RELEASE       1.1.10.RELEASE 
     2.2.2.RELEASE       2.0.2.RELEASE       1.4.5.RELEASE       1.1.9.RELEASE  
     2.2.1.RELEASE       2.0.1.RELEASE       1.4.4.RELEASE       1.1.8.RELEASE  
     2.2.0.RELEASE       2.0.0.RELEASE       1.4.3.RELEASE       1.1.7.RELEASE  
     2.1.16.RELEASE      1.5.22.RELEASE      1.4.2.RELEASE       1.1.6.RELEASE  
     2.1.15.RELEASE      1.5.21.RELEASE      1.4.1.RELEASE       1.1.5.RELEASE  
     2.1.14.RELEASE      1.5.20.RELEASE      1.4.0.RELEASE       1.1.4.RELEASE  
     2.1.13.RELEASE      1.5.19.RELEASE      1.3.8.RELEASE       1.1.3.RELEASE  
     2.1.12.RELEASE      1.5.18.RELEASE      1.3.7.RELEASE       1.1.2.RELEASE  
     2.1.11.RELEASE      1.5.17.RELEASE      1.3.6.RELEASE       1.1.1.RELEASE  
     2.1.10.RELEASE      1.5.16.RELEASE      1.3.5.RELEASE       1.1.0.RELEASE  
     2.1.9.RELEASE       1.5.15.RELEASE      1.3.4.RELEASE       1.0.2.RELEASE  
     2.1.8.RELEASE       1.5.14.RELEASE      1.3.3.RELEASE       1.0.1.RELEASE  
     2.1.7.RELEASE       1.5.13.RELEASE      1.3.2.RELEASE       1.0.0.RELEASE  
     2.1.6.RELEASE       1.5.12.RELEASE      1.3.1.RELEASE                      
     2.1.5.RELEASE       1.5.11.RELEASE      1.3.0.RELEASE                      
     2.1.4.RELEASE       1.5.10.RELEASE      1.2.8.RELEASE                      

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================

closed time in 6 hours

alesbukovsky

issue commentspring-projects/spring-boot

Spring Boot 2.3.4.RELEASE not published on SDKMAN

@alesbukovsky thank you for letting us know. We should be good now.

alesbukovsky

comment created time in 6 hours

push eventsnicoll/spring-boot

Stephane Nicoll

commit sha cd7f140a17807c5170ac672833862a2ac5aaacef

Hacking See gh-23480

view details

push time in 7 hours

issue openedspring-projects/spring-boot

Sort dependency upgrades in changelog

Now that https://github.com/spring-io/github-changelog-generator/issues/34 is implemented, It would be great if dependency upgrades were sorted in the changelog as I feel it would be easier for folks to identify dependency upgrades they're interested in.

created time in 11 hours

issue commentspring-projects/spring-boot

ConfigurationPropertyNameAliases should not use alias once the value has been bound

To reproduce quickly the issue, you need to patch DataSourceBuilder as follows and the run CommonsDbcp2DataSourcePoolMetadataTests. Both setDriverClassName and setConnectionFactoryClassName will be invoked because those two properties are present in the environment.

snicoll

comment created time in a day

create barnchsnicoll/spring-boot

branch : gh-23480

created branch time in a day

issue closedspring-projects/spring-boot

Support Oracle UCP

It would be nice to support Oracle UCP pooling. The reason for it is that Oracle is in very widespread use in enterprise environments. UCP is the preferred way to pooling with Oracle (the built-in pooling in the driver is deprecated). UCP adds additional enterprise-grade capabilities, such as support for ONS (Oracle Notification Service), FCF (Fast Connection Failover), enhanced JMX-introspection, RAC support etc.

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/jjucp/intro.html#GUID-8CF6555B-E7EA-462C-88C8-78678E43BD17

But given the comments in: https://github.com/spring-projects/spring-boot/issues/8700 this might not be acceptable, as I guess access to the Oracle Maven repo would be required (if not dealing with it all through reflection, which is not ideal).

WDYT?

If not directly in spring boot due to the above challenge with repos, would https://projects.spring.io/spring-data-jdbc-ext/ be a better place? But I do not see any specific boot support in spring-data - and also the project does not seem very active with releases etc.

Boot is used a lot in enterprise envs, and supporting enterprise requirements and best-practice patterns in the framework seems sane to me.

closed time in a day

davidkarlsen

issue commentspring-projects/spring-boot

Support Oracle UCP

Closing in favour of PR #23403

davidkarlsen

comment created time in a day

issue commentspring-projects/spring-boot

ConfigurationPropertyNameAliases should not use alias once the value has been bound

Taking a step back, it's rather ConfigurationPropertyNameAliases that attempts to bind to any alias that is configured irrespective to the fact that the "main property" has been bound.

snicoll

comment created time in a day

issue openedspring-projects/spring-boot

DataSourceBuilder should only alias a property when the expected DataSource is configured

DataSourceBuilder has a number of aliases to accommodate for small changes in API. For instance, Hikari has a jdbc-url rather than the more common url property so we have a mapping for that. This mapping is useless if the DataSource we configure isn't using Hikari.

So far we got away with it, but adding support for Oracle UCP means we need to add yet another alias that's actually a valid property for DBCP2 (yet referring to something completely different).

created time in a day

pull request commentspring-projects/spring-boot

Support Oracle UCP (resolves gh-12865)

I've started to review and polish this. Unfortunately the use of alises has some limit. UCP requires us to map the driver class name to connection-factory-class-name. DBCP2's BasicDataSource happens to have exactly the same property for something entirely different.

fabio-grassi-gbs

comment created time in a day

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 4009acf025b3a6926c6eeedd38618d2fd67210cc

Add support for Hazelcast This commit upgrades to Hazelcast 4.0.3, yet keeping compatibility with Hazelcast 3.x. Closes gh-20856 Closes gh-23475

view details

Stephane Nicoll

commit sha 4d33062d30da15fde76996c795b41fcdd92660f7

Upgrade to Hazelcast Hibernate5 2.1.1 Closes gh-23476

view details

push time in a day

issue closedspring-projects/spring-boot

Add support for Hazelcast 4

With Hazelcast 4.0, Spring Boot 2.2.6 is not properly adhering to the spring.hazelcast.config application property which allows pointing to a specific Hazelcast configuration and then instantiating the proper bean.

Spring Boot is attempting to create a HazelcastInstance of HazelcastClientConfiguration (which expects <hazelcast-client> XML root tag) instead of HazelcastServerConfiguration (which expects <hazelcast> XML root tag).

The error that occurs:

Invalid root element in xml configuration! Expected: <hazelcast-client>, Actual: <hazelcast>.

The following Github repository depicts two example Spring Boot 2.2.6 projects, one with this error, and one with a workaround:

https://github.com/justinnichols/spring-boot-2.2.6-hazelcast-4.0

Dependencies:

<dependency>
	<groupId>com.hazelcast</groupId>
	<artifactId>hazelcast</artifactId>
	<version>4.0</version>
</dependency>

Configuration in application.properties:

spring.hazelcast.config=classpath:config/hazelcast.xml

The stacktrace that occurs is:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hazelcastInstance' defined in class path resource [org/springframework/boot/autoconfigure/hazelcast/HazelcastClientConfiguration$HazelcastClientConfigFileConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is com.hazelcast.config.InvalidConfigurationException: Invalid root element in xml configuration! Expected: <hazelcast-client>, Actual: <hazelcast>.
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1290) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1210) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:885) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:789) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	... 18 common frames omitted

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.hazelcast.core.HazelcastInstance]: Factory method 'hazelcastInstance' threw exception; nested exception is com.hazelcast.config.InvalidConfigurationException: Invalid root element in xml configuration! Expected: <hazelcast-client>, Actual: <hazelcast>.
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
	... 32 common frames omitted

Caused by: com.hazelcast.config.InvalidConfigurationException: Invalid root element in xml configuration! Expected: <hazelcast-client>, Actual: <hazelcast>.
	at com.hazelcast.client.config.XmlClientConfigBuilder.checkRootElement(XmlClientConfigBuilder.java:183) ~[hazelcast-4.0.jar:4.0]
	at com.hazelcast.client.config.XmlClientConfigBuilder.parseAndBuildConfig(XmlClientConfigBuilder.java:168) ~[hazelcast-4.0.jar:4.0]
	at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:157) ~[hazelcast-4.0.jar:4.0]
	at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:150) ~[hazelcast-4.0.jar:4.0]
	at com.hazelcast.client.config.XmlClientConfigBuilder.build(XmlClientConfigBuilder.java:145) ~[hazelcast-4.0.jar:4.0]
	at org.springframework.boot.autoconfigure.hazelcast.HazelcastClientFactory.getClientConfig(HazelcastClientFactory.java:66) ~[spring-boot-autoconfigure-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.autoconfigure.hazelcast.HazelcastClientFactory.<init>(HazelcastClientFactory.java:48) ~[spring-boot-autoconfigure-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at org.springframework.boot.autoconfigure.hazelcast.HazelcastClientConfiguration$HazelcastClientConfigFileConfiguration.hazelcastInstance(HazelcastClientConfiguration.java:55) ~[spring-boot-autoconfigure-2.2.6.RELEASE.jar:2.2.6.RELEASE]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_192]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_192]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_192]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_192]
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]

Workarounds (kindly provided by @mesutcelik via Gitter)

  • Place the hazelcast.xml in the root of the classpath. (This is depicted in the repo linked above)
  • Specify a hazelcast.config system property.
  • Define a configuration bean programmatically.

closed time in a day

justinnichols

issue commentspring-projects/spring-boot

Upgrade to Hazelcast 4.0.3

Note that while Spring Boot 2.4.x upgrades to Hazelcast 4, 3.2.x is still supported and users can use hazelcast.version to downgrade if necessary.

snicoll

comment created time in a day

issue openedspring-projects/spring-boot

Upgrade to Hazelcast 4.0.3

created time in a day

issue commentspring-projects/spring-framework

Document that TransactionalEventListener only works with non-reactive transactions

Thanks for letting us know about the duplicate @mp911de. We'll use this issue to document the support a bit more explicitly.

codependent

comment created time in a day

pull request commentspring-projects/spring-boot

Add Cassandra driver Actuator metrics

I should also mentioned that I've started to polish the proposal already so there is no need to push additional commits. I'd like some feedback on what API I should be using so that users can override those settings if they want to.

emerkle826

comment created time in a day

PullRequestReviewEvent

Pull request review commentspring-projects/spring-boot

Add Cassandra driver Actuator metrics

+/*+ * Copyright 2020 the original author or authors.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.springframework.boot.actuate.autoconfigure.metrics.cassandra;++import java.util.stream.Collectors;+import java.util.stream.Stream;++import com.datastax.oss.driver.api.core.CqlSession;+import com.datastax.oss.driver.api.core.config.DefaultDriverOption;+import com.datastax.oss.driver.api.core.metrics.DefaultNodeMetric;+import com.datastax.oss.driver.api.core.metrics.DefaultSessionMetric;+import com.datastax.oss.driver.internal.metrics.micrometer.MicrometerMetricsFactory;+import io.micrometer.core.instrument.MeterRegistry;++import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;+import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;+import org.springframework.boot.autoconfigure.AutoConfigureAfter;+import org.springframework.boot.autoconfigure.AutoConfigureBefore;+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;+import org.springframework.boot.autoconfigure.cassandra.CqlSessionBuilderCustomizer;+import org.springframework.boot.autoconfigure.cassandra.DriverConfigLoaderBuilderCustomizer;+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;+import org.springframework.context.annotation.Bean;+import org.springframework.context.annotation.Configuration;++/**+ * {@link EnableAutoConfiguration Auto-configuration} for metrics on all available+ * {@link CqlSession Cassandra sessions}.+ *+ * @author Erik Merkle+ * @since 2.4.0+ */+@Configuration+@AutoConfigureAfter({ MetricsAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class })+@AutoConfigureBefore({ CassandraAutoConfiguration.class })+@ConditionalOnClass({ MeterRegistry.class, MicrometerMetricsFactory.class })+@ConditionalOnBean({ MeterRegistry.class })+public class CassandraMetricsAutoConfiguration {++	@Bean+	public DriverConfigLoaderBuilderCustomizer cassandraMetricsConfigCustomizer() {+		return (builder) -> builder.withString(DefaultDriverOption.METRICS_FACTORY_CLASS, "MicrometerMetricsFactory")+				.withStringList(DefaultDriverOption.METRICS_SESSION_ENABLED,

I've tried to write some more test where someone would want to override those settings. Unfortunately that didn't work as calling withString with the same key in another customizer leads to:

Caused by: java.lang.IllegalArgumentException: Duplicate key datastax-java-driver.advanced.metrics.session.enabled
	at com.datastax.oss.protocol.internal.util.collection.NullAllowingImmutableMap$Builder.failIfDuplicateKeys(NullAllowingImmutableMap.java:226)
	at com.datastax.oss.protocol.internal.util.collection.NullAllowingImmutableMap$Builder.build(NullAllowingImmutableMap.java:198)
	at com.datastax.oss.driver.internal.core.config.typesafe.DefaultProgrammaticDriverConfigLoaderBuilder.buildConfig(DefaultProgrammaticDriverConfigLoaderBuilder.java:263)
	at com.datastax.oss.driver.internal.core.config.typesafe.DefaultProgrammaticDriverConfigLoaderBuilder.lambda$build$2(DefaultProgrammaticDriverConfigLoaderBuilder.java:248)
	at com.datastax.oss.driver.internal.core.config.typesafe.DefaultDriverConfigLoader.<init>(DefaultDriverConfigLoader.java:131)
	at com.datastax.oss.driver.internal.core.config.typesafe.DefaultDriverConfigLoader.<init>(DefaultDriverConfigLoader.java:117)
	at com.datastax.oss.driver.internal.core.config.typesafe.DefaultProgrammaticDriverConfigLoaderBuilder.build(DefaultProgrammaticDriverConfigLoaderBuilder.java:245)
	at org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration.cassandraDriverConfigLoader(CassandraAutoConfiguration.java:114)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)

I think we need a way to support this use case, we can't blindly set those values without a way for users to customise them. Is there a way to know that a key has been registered already (and therefore not apply anything) or a way for users to override whatever value has been set?

I'd prefer the former as it makes the auto-configuration backs off in a consistent way. If only the latter is possible, that would mean that the customizer should be ordered to run after the auto-configured one which is more work than it should IMO.

emerkle826

comment created time in a day

Pull request review commentspring-projects/spring-boot

Add Cassandra driver Actuator metrics

+/*+ * Copyright 2020 the original author or authors.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.springframework.boot.actuate.autoconfigure.metrics.cassandra;++import java.time.Duration;++import com.datastax.oss.driver.api.core.ConsistencyLevel;+import com.datastax.oss.driver.api.core.CqlSession;+import com.datastax.oss.driver.api.core.cql.SimpleStatement;+import com.datastax.oss.driver.api.core.metrics.DefaultNodeMetric;+import com.datastax.oss.driver.api.core.metrics.DefaultSessionMetric;+import io.micrometer.core.instrument.MeterRegistry;+import org.junit.jupiter.api.Test;+import org.testcontainers.containers.CassandraContainer;+import org.testcontainers.containers.wait.CassandraQueryWaitStrategy;+import org.testcontainers.junit.jupiter.Container;+import org.testcontainers.junit.jupiter.Testcontainers;++import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;+import org.springframework.boot.autoconfigure.AutoConfigurations;+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;+import org.springframework.boot.test.context.runner.ApplicationContextRunner;++import static org.assertj.core.api.Assertions.assertThat;++/**+ * Tests for {@link CassandraMetricsAutoConfiguration}.+ *+ * @author Erik Merkle+ */+@Testcontainers(disabledWithoutDocker = true)+public class CassandraMetricsAutoConfigurationIntegrationTests {++	@Container+	static final CassandraContainer<?> cassandra = new CassandraContainer<>().withStartupAttempts(5)+			.withStartupTimeout(Duration.ofMinutes(10)).waitingFor(new CassandraQueryWaitStrategy());++	private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().with(MetricsRun.simple())+			.withConfiguration(+					AutoConfigurations.of(CassandraMetricsAutoConfiguration.class, CassandraAutoConfiguration.class))+			.withPropertyValues(+					"spring.data.cassandra.contact-points:" + cassandra.getHost() + ":"+							+ cassandra.getFirstMappedPort(),+					"spring.data.cassandra.local-datacenter=datacenter1", "spring.data.cassandra.read-timeout=20s",+					"spring.data.cassandra.connect-timeout=10s");++	/**+	 * Cassandra driver metrics should be enabled by default as long as the desired+	 * metrics are enabled in the Driver's configuration.+	 */+	@Test+	void autoConfiguredCassandraIsInstrumented() {+		this.contextRunner.run((context) -> {+			MeterRegistry registry = context.getBean(MeterRegistry.class);+			// execute queries to peg metrics+			CqlSession session = context.getBean(CqlSession.class);+			SimpleStatement statement = SimpleStatement.newInstance("SELECT release_version FROM system.local")+					.setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);+			for (int i = 0; i < 10; ++i) {+				assertThat(session.execute(statement).one()).isNotNull();

Why do you need to loop 10 times here?

emerkle826

comment created time in a day

Pull request review commentspring-projects/spring-boot

Add Cassandra driver Actuator metrics

+/*+ * Copyright 2020 the original author or authors.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.springframework.boot.actuate.autoconfigure.metrics.cassandra;++import java.time.Duration;++import com.datastax.oss.driver.api.core.ConsistencyLevel;+import com.datastax.oss.driver.api.core.CqlSession;+import com.datastax.oss.driver.api.core.cql.SimpleStatement;+import com.datastax.oss.driver.api.core.metrics.DefaultNodeMetric;+import com.datastax.oss.driver.api.core.metrics.DefaultSessionMetric;+import io.micrometer.core.instrument.MeterRegistry;+import org.junit.jupiter.api.Test;+import org.testcontainers.containers.CassandraContainer;+import org.testcontainers.containers.wait.CassandraQueryWaitStrategy;+import org.testcontainers.junit.jupiter.Container;+import org.testcontainers.junit.jupiter.Testcontainers;++import org.springframework.boot.actuate.autoconfigure.metrics.test.MetricsRun;+import org.springframework.boot.autoconfigure.AutoConfigurations;+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;+import org.springframework.boot.test.context.runner.ApplicationContextRunner;++import static org.assertj.core.api.Assertions.assertThat;++/**+ * Tests for {@link CassandraMetricsAutoConfiguration}.+ *+ * @author Erik Merkle+ */+@Testcontainers(disabledWithoutDocker = true)+public class CassandraMetricsAutoConfigurationIntegrationTests {++	@Container+	static final CassandraContainer<?> cassandra = new CassandraContainer<>().withStartupAttempts(5)+			.withStartupTimeout(Duration.ofMinutes(10)).waitingFor(new CassandraQueryWaitStrategy());++	private final ApplicationContextRunner contextRunner = new ApplicationContextRunner().with(MetricsRun.simple())+			.withConfiguration(+					AutoConfigurations.of(CassandraMetricsAutoConfiguration.class, CassandraAutoConfiguration.class))+			.withPropertyValues(+					"spring.data.cassandra.contact-points:" + cassandra.getHost() + ":"+							+ cassandra.getFirstMappedPort(),+					"spring.data.cassandra.local-datacenter=datacenter1", "spring.data.cassandra.read-timeout=20s",+					"spring.data.cassandra.connect-timeout=10s");++	/**+	 * Cassandra driver metrics should be enabled by default as long as the desired+	 * metrics are enabled in the Driver's configuration.+	 */+	@Test+	void autoConfiguredCassandraIsInstrumented() {+		this.contextRunner.run((context) -> {+			MeterRegistry registry = context.getBean(MeterRegistry.class);+			// execute queries to peg metrics+			CqlSession session = context.getBean(CqlSession.class);+			SimpleStatement statement = SimpleStatement.newInstance("SELECT release_version FROM system.local")+					.setConsistencyLevel(ConsistencyLevel.LOCAL_ONE);+			for (int i = 0; i < 10; ++i) {+				assertThat(session.execute(statement).one()).isNotNull();+			}+			// assert Session metrics+			String sessionMetricPrefix = session.getContext().getSessionName() + ".";+			assertThat(+					registry.get(sessionMetricPrefix + DefaultSessionMetric.CONNECTED_NODES.getPath()).gauge().value())+							.isEqualTo(1d);+			assertThat(registry.get(sessionMetricPrefix + DefaultSessionMetric.CQL_REQUESTS.getPath()).timer().count())+					.isEqualTo(10L);

I was a bit confused by that. The waitStrategy runs some CQL requests as well, doesn't it? That makes this test a bit fragile IMO.

emerkle826

comment created time in a day

Pull request review commentspring-projects/spring-boot

Add Cassandra driver Actuator metrics

+/*+ * Copyright 2020 the original author or authors.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ *      https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.+ */+package org.springframework.boot.actuate.autoconfigure.metrics.cassandra;++import java.util.stream.Collectors;+import java.util.stream.Stream;++import com.datastax.oss.driver.api.core.CqlSession;+import com.datastax.oss.driver.api.core.config.DefaultDriverOption;+import com.datastax.oss.driver.api.core.metrics.DefaultNodeMetric;+import com.datastax.oss.driver.api.core.metrics.DefaultSessionMetric;+import com.datastax.oss.driver.internal.metrics.micrometer.MicrometerMetricsFactory;+import io.micrometer.core.instrument.MeterRegistry;++import org.springframework.boot.actuate.autoconfigure.metrics.MetricsAutoConfiguration;+import org.springframework.boot.actuate.autoconfigure.metrics.export.simple.SimpleMetricsExportAutoConfiguration;+import org.springframework.boot.autoconfigure.AutoConfigureAfter;+import org.springframework.boot.autoconfigure.AutoConfigureBefore;+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;+import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;+import org.springframework.boot.autoconfigure.cassandra.CqlSessionBuilderCustomizer;+import org.springframework.boot.autoconfigure.cassandra.DriverConfigLoaderBuilderCustomizer;+import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;+import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;+import org.springframework.context.annotation.Bean;+import org.springframework.context.annotation.Configuration;++/**+ * {@link EnableAutoConfiguration Auto-configuration} for metrics on all available+ * {@link CqlSession Cassandra sessions}.+ *+ * @author Erik Merkle+ * @since 2.4.0+ */+@Configuration+@AutoConfigureAfter({ MetricsAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class })+@AutoConfigureBefore({ CassandraAutoConfiguration.class })+@ConditionalOnClass({ MeterRegistry.class, MicrometerMetricsFactory.class })+@ConditionalOnBean({ MeterRegistry.class })+public class CassandraMetricsAutoConfiguration {++	@Bean+	public DriverConfigLoaderBuilderCustomizer cassandraMetricsConfigCustomizer() {+		return (builder) -> builder.withString(DefaultDriverOption.METRICS_FACTORY_CLASS, "MicrometerMetricsFactory")

You can import and use the class here, @ConditionalOnClass is evaluated without loading the class itself.

emerkle826

comment created time in a day

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentspring-projects/spring-boot

Fix typos

Thanks again @thorasine.

thorasine

comment created time in a day

push eventspring-projects/spring-boot

thorasine

commit sha 2d74aef6ef7355a84cf2c19b7b2ce7e298b6d236

Fix typos See gh-23465

view details

Stephane Nicoll

commit sha ab373459fc792adc8cb9d90f2bffd6cb0da6063d

Merge pull request #23465 from thorasine * pr/23465: Fix typos Closes gh-23465

view details

push time in a day

PR closed spring-projects/spring-boot

Fix typos type: documentation

Small PR to fix a couple typos in the documentation.

+3 -3

0 comment

1 changed file

thorasine

pr closed time in a day

issue commentspring-projects/spring-boot

dbcp2 auto config is missing ability to set connectionProperties

I have some sympathy for that argument Andy. The fact that the binder can do things the annotation processor doesn't detect is annoying but, on the other hand, I think we need to draw a line somewhere.

Updating the AP to be more lenient if there is a getter/setter and the type does not match could be an option but I am not keen at all to expose properties that only have a setter. This is most probably going to break users that are relying on the current conventions to only expose what they want.

Thinking about this one so more, I think the problem is to do with third party class binding. Sure that's convenient and we make sure that the version we test against has "all the properties" exposed without us having to change any code but:

  • Not having documentation for those is annoying and users have been reported that in the past several times
  • We're at the mercy of whatever our 3rd party binding does. Although I find the API for connection properties a bit weird, we can't expect the DBCP2 project to align with our conventions
  • We've moved away from third party binding for other features. Flyway comes to mind.

My opinion is that we should stop changing things for the third party binding use case and we should keep the current JavaBean standard expectations. Although it is a lot of work, I suggest we create a separate issue to remove third party binding for all connection pools and do the mapping ourselves. We could document the properties and add a test that checks that for every javabean property found via reflection we have a mapping.

Thanks @jbotuck for bearing with me!

jbotuck

comment created time in a day

issue commentspring-projects/spring-boot

dbcp2 auto config is missing ability to set connectionProperties

Can we add the property to the documentation here? https://docs.spring.io/spring-boot/docs/current/reference/html/appendix-application-properties.html#data-properties.

I am afraid we can't. Because it isn't really a valid property, it isn't detected and therefore not documented.

I'd feel better about using this if it wasn't some undocumented feature that can be removed at any time.

Documenting it wouldn't change anything to the fact that the DBCP2 project may decide to remove or change it at any time. We don't have any control on that.

jbotuck

comment created time in 2 days

issue closedspring-projects/spring-boot

dbcp2 auto config is missing ability to set connectionProperties

Most of the setters in BasicDataSource can be configured from application.yml. https://commons.apache.org/proper/commons-dbcp/apidocs/org/apache/commons/dbcp2/BasicDataSource.html#setConnectionProperties-java.lang.String- cannot be configured.

Both Hikari and Tomcat have ways of configuring the properties that get sent to the driver but dbcp2 does not as this setter seems not to get registered by the @ConfigurationProperties annotation.

This limits the configurability of a dbcp2 datasource via spring boot

closed time in 2 days

jbotuck

issue commentspring-projects/spring-boot

dbcp2 auto config is missing ability to set connectionProperties

Spring boot allows this kind of configuration for both hikari and tomcat using spring.datasource.hikari.data-source-properties and spring.datasource.tomcat.connection-properties.

Again, as I've mentioned previously, there is nothing that Spring Boot does specifically for those two properties. Both Hikari and Tomcat exposes an accessor named "connection-properties" and that's about it.

If its not possible to bring dbcp2 up to parity with the other datasources because dbcp2 violates the javabean spec then how should I configure these properties in a spring boot application?

I've copy/pasted spring.datasource.dbcp2.connection-properties=enableRowsetSupport=1; in application.properties of a fresh app configured from start.spring.io and I can see via the debugger that BasicDataSource#setConnectionProperties is invoked with enableRowsetSupport=1;. It should be noted though that, because this property is unusual, there is no code assistance in the IDE.

I am going to close this now as there is no indication of a problem in Spring Boot.

jbotuck

comment created time in 2 days

pull request commentspring-projects/spring-boot

Improve CassandraHealthIndicator with more robust mechanism fixes gh-22901

@tomekl007 do you have time to process feedback on this PR?

tomekl007

comment created time in 2 days

pull request commentspring-projects/spring-boot

Fix link to Log4j's JDK Logging Adapter in reference documentation

@pavelgordon thank you for making your first contribution to Spring Boot.

pavelgordon

comment created time in 2 days

push eventspring-projects/spring-boot

Pavel Gordon

commit sha 62eb835a4e506efdfd5fcc637c800237f44e115a

Fix link to Log4j's JDK Logging Adapter in reference documentation See gh-23459

view details

Stephane Nicoll

commit sha 69ca3a9169c4405c68be6466b5ccf6a2e11754ef

Merge pull request #23459 from pavelgordon * pr/23459: Fix link to Log4j's JDK Logging Adapter in reference documentation Closes gh-23459

view details

Stephane Nicoll

commit sha b3c5588c866273585184dea4f73d918982fdb83c

Merge branch '2.2.x' into 2.3.x Closes gh-23461

view details

Stephane Nicoll

commit sha c44e1ec0ad8d910a02aaa70b1c1820bb27a5526b

Merge branch '2.3.x' Closes gh-23462

view details

push time in 2 days

issue closedspring-projects/spring-boot

Fix link to Log4j's JDK Logging Adapter in reference documentation

Forward port of issue #23459 to 2.3.x.

closed time in 2 days

snicoll

PR closed spring-projects/spring-boot

Fix link to Log4j's JDK Logging Adapter in reference documentation type: documentation

I noticed that the link to Log4j JDK Logging Adapter is not working anymore - maybe they changed it in a process. Anyway, here is my minor PR to keep the documentation up-to-date and provide correct link.

<!-- Thanks for contributing to Spring Boot. Please review the following notes before submitting you pull request.

Please submit only genuine pull-requests. Do not use this repository as a GitHub playground.

Security Vulnerabilities

STOP! If your contribution fixes a security vulnerability, please do not submit it. Instead, please head over to https://pivotal.io/security to learn how to disclose a vulnerability responsibly.

Dependency Upgrades

Please do not open a pull request for a straightforward dependency upgrade (one that only updates the version property). We have a semi-automated process for such upgrades that we prefer to use. However, if the upgrade is more involved (such as requiring changes for removed or deprecated API) your pull request is most welcome.

Describing Your Changes

If, having reviewed the notes above, you're ready to submit your pull request, please provide a brief description of the proposed changes. If they fix a bug, please describe the broken behaviour and how the changes fix it. If they make an enhancement, please describe the new functionality and why you believe it's useful. If your pull request relates to any existing issues, please reference them by using the issue number prefixed with #. -->

+1 -1

2 comments

1 changed file

pavelgordon

pr closed time in 2 days

issue openedspring-projects/spring-boot

Fix link to Log4j's JDK Logging Adapter in reference documentation

Forward port of issue #23461 to 2.4.x.

created time in 2 days

push eventspring-projects/spring-boot

Pavel Gordon

commit sha 62eb835a4e506efdfd5fcc637c800237f44e115a

Fix link to Log4j's JDK Logging Adapter in reference documentation See gh-23459

view details

Stephane Nicoll

commit sha 69ca3a9169c4405c68be6466b5ccf6a2e11754ef

Merge pull request #23459 from pavelgordon * pr/23459: Fix link to Log4j's JDK Logging Adapter in reference documentation Closes gh-23459

view details

Stephane Nicoll

commit sha b3c5588c866273585184dea4f73d918982fdb83c

Merge branch '2.2.x' into 2.3.x Closes gh-23461

view details

push time in 2 days

issue openedspring-projects/spring-boot

Fix link to Log4j's JDK Logging Adapter in reference documentation

Forward port of issue #23459 to 2.3.x.

created time in 2 days

push eventspring-projects/spring-boot

Pavel Gordon

commit sha 62eb835a4e506efdfd5fcc637c800237f44e115a

Fix link to Log4j's JDK Logging Adapter in reference documentation See gh-23459

view details

Stephane Nicoll

commit sha 69ca3a9169c4405c68be6466b5ccf6a2e11754ef

Merge pull request #23459 from pavelgordon * pr/23459: Fix link to Log4j's JDK Logging Adapter in reference documentation Closes gh-23459

view details

push time in 2 days

pull request commentspring-projects/spring-boot

Fix typo

@thorasine thank you for making your first contribution to Spring Boot.

thorasine

comment created time in 2 days

push eventspring-projects/spring-boot

thorasine

commit sha 9955dac31687f40de59d2178056bdad705965ba7

Fix typo See gh-23456

view details

Stephane Nicoll

commit sha 18b75128263e22f962b22fb16320c9e3bd5c4602

Merge pull request #23456 from thorasine * pr/23456: Fix typo Closes gh-23456

view details

push time in 2 days

PR closed spring-projects/spring-boot

Fix typo type: documentation

This tiny PR fixes a typo

+1 -1

2 comments

1 changed file

thorasine

pr closed time in 2 days

issue closedspring-io/spring-javaformat

Import is not optimized

spring-javaformat does not optimize import

closed time in 2 days

tonycody

issue commentspring-io/spring-javaformat

Import is not optimized

Thanks for the report but the README already indicates that this isn't in the scope of this project.

tonycody

comment created time in 2 days

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 4d10fbfd529c4ebf5d3b6ecd1375116eb792cac8

Rewrite JobLauncherApplicationRunnerTests This commit rewrites the test to use an in-memory database rather than the deprecated Map-based arrangement. Closes gh-23369

view details

push time in 2 days

issue closedspring-projects/spring-boot

Rewrite JobLauncherApplicationRunnerTests

JobLauncherApplicationRunnerTests is quite involved and could use the new ApplicationContextRunner infrastructure rather than doing the setup manually.

We recently added a @SuppressWarnings as MapJobRepositoryFactoryBean is deprecated. We should switch to using an in-memory DB for this instead.

closed time in 2 days

snicoll

issue closedspring-io/start.spring.io

Spring aop dependency not available at Spring Initializr

Hi, I am trying to generate a project through https://start.spring.io/ and trying to add aop dependency. If I type AOP or Aspect while adding the dependency, nothing shows up. I can see a lot of duplicate issues on the same topic. But, everything is closed. Not sure, whether it is a bug in latest versions. I tried with spring boot version 2.2.10 and 2.3.4 Thanks.

closed time in 2 days

MuthiahPrabhakaran

issue commentspring-io/start.spring.io

Spring aop dependency not available at Spring Initializr

I can see a lot of duplicate issues on the same topic. But, everything is closed.

One of those duplicate issue is #180 where we explain why we intentionally removed the entry.

MuthiahPrabhakaran

comment created time in 2 days

issue commentspring-projects/spring-framework

Support interception of calls to the underlying cache

Well, it's not so much about abstracting the underlying cache, but transforming the value that's set into the cache.

Yes but that contract already exists in the Cache interface and creating yet another contract as a maintenance cost that isn't worth it.

maybe https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/cache/Cache.ValueWrapper.html with a set() in addition to the get() could be a way to go?

Certainly not, ValueWrapper must be immutable.

davidkarlsen

comment created time in 2 days

issue commentspring-cloud/spring-cloud-release

Provide getting started with release trains mapping to Spring Boot generation

Looks good indeed, I think this can be closed. Thanks a lot for the quick turnaround!

snicoll

comment created time in 2 days

issue openedspring-io/initializr

Spring Boot version metadata reader should not rely on order

Right now, we rely on the order of the available versions to present versions to users. If Sagan changes that order, this has a direct impact on us as we'd offer the exact same order. We should rather have a deterministic order, probably from the newest to the oldest (as it used to be the case).

created time in 3 days

issue commentspring-projects/spring-boot

Add property to disable auto generation of embeded DataSource

This can be undesired if for example HSQLDB is on the class path for other purposes but the primary data source should always be configured explicitly and yield an error if missing.

Thanks for the report but I am not sure I understood that. What primary data source? Can we take a step back and can you please describe the use case that led you to report this?

raphw

comment created time in 3 days

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 2999f09a409675bb53fce63715de3becc65d920c

Rework tip on templates location in the IDE This commit rework the tip on locating templates when running the app in the IDE. Using classpath* should not change anything as this won't make a difference without a pattern in the path. Closes gh-23068

view details

Stephane Nicoll

commit sha 3adf06df175e658a6bd66c5570130f85d6184b0e

Merge branch '2.2.x' into 2.3.x Closes gh-23452

view details

Stephane Nicoll

commit sha 7d984d7f892c3c5de0ffbc58522f9f18b4d4c3da

Merge branch '2.3.x' Closes gh-23453

view details

push time in 3 days

issue closedspring-projects/spring-boot

Revisit hint on using classpath* for retrieving templates

Forward port of issue #23452 to 2.4.x.

closed time in 3 days

snicoll

issue closedspring-projects/spring-boot

Revisit hint on using classpath* for retrieving templates

Forward port of issue #23068 to 2.3.x.

closed time in 3 days

snicoll

issue closedspring-projects/spring-boot

Revisit hint on using classpath* for retrieving templates

See https://github.com/spring-projects/spring-boot/issues/23051#issuecomment-679191023

closed time in 3 days

snicoll

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 2999f09a409675bb53fce63715de3becc65d920c

Rework tip on templates location in the IDE This commit rework the tip on locating templates when running the app in the IDE. Using classpath* should not change anything as this won't make a difference without a pattern in the path. Closes gh-23068

view details

Stephane Nicoll

commit sha 3adf06df175e658a6bd66c5570130f85d6184b0e

Merge branch '2.2.x' into 2.3.x Closes gh-23452

view details

push time in 3 days

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 2999f09a409675bb53fce63715de3becc65d920c

Rework tip on templates location in the IDE This commit rework the tip on locating templates when running the app in the IDE. Using classpath* should not change anything as this won't make a difference without a pattern in the path. Closes gh-23068

view details

push time in 3 days

issue openedspring-projects/spring-boot

Revisit hint on using classpath* for retrieving templates

Forward port of issue #23452 to 2.4.x.

created time in 3 days

issue openedspring-projects/spring-boot

Revisit hint on using classpath* for retrieving templates

Forward port of issue #23068 to 2.3.x.

created time in 3 days

issue openedspring-projects/spring-boot

Support CalVer format more explicitly

Some projects have switched from an alphabetical release train scheme to a CalVer format. As we don't know that format, it considers that 2020 is "older" than, say, Aluminium-RELEASE.

It would be nice if bomr understands this new format and only offer (actual) newest releases that match the current policy.

created time in 3 days

issue commentspring-projects/spring-boot

Revisit hint on using classpath* for retrieving templates

We've decided to remove the notes in 2.2.x forward and remove the code only in 2.4.x in case there is a side effect we haven't foreseen.

snicoll

comment created time in 3 days

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 1258bce57a2a781fed0c808506ba39fb9d1b19a0

Add bomr exclusion for Apache Solr 8.6+ Closes gh-23370

view details

push time in 3 days

issue closedspring-projects/spring-boot

Add bomr exclusion for Apache Solr 8.6+

See https://github.com/spring-projects/spring-boot/issues/23197#issuecomment-693401904

closed time in 3 days

snicoll

issue commentspring-projects/spring-boot

Datasource initialisation with JPA schema configured in deferred mode happens asynchronously

I've created https://github.com/spring-projects/spring-framework/issues/25799

wikisamuel

comment created time in 3 days

issue openedspring-projects/spring-framework

Sending an event as part of the EMF lock triggers a deadlock

In Spring Boot we have some custom DataSource initialisation that needs to know about the state of the EMF. When JPA is bootstrapped in deferred mode, we need to make sure that our core runs as part of that lock.

For this we use JpaVendorAdapter#postProcessEntityManagerFactory. Our implementation sends a event and another component uses that as a trigger to do more things.

Unfortunately this setup leads to a deadlock in the main thread:

"main" #1 prio=5 os_prio=31 tid=0x00007f80d500c000 nid=0x2903 waiting on condition [0x000070000fd6a000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000007236fb408> (a java.util.concurrent.FutureTask)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.FutureTask.awaitDone(FutureTask.java:429)
	at java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.getNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:540)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:497)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:680)
	at com.sun.proxy.$Proxy57.getMetamodel(Unknown Source)
	at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean$$Lambda$576/2014729464.apply(Unknown Source)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Iterator.forEachRemaining(Iterator.java:116)
	at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.getMetamodels(JpaMetamodelMappingContextFactoryBean.java:106)
	at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:80)
	at org.springframework.data.jpa.repository.config.JpaMetamodelMappingContextFactoryBean.createInstance(JpaMetamodelMappingContextFactoryBean.java:44)
	at org.springframework.beans.factory.config.AbstractFactoryBean.afterPropertiesSet(AbstractFactoryBean.java:142)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1853)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1790)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$337/1777443462.getObject(Unknown Source)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	- locked <0x000000072146f420> (a java.util.concurrent.ConcurrentHashMap)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1697)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1442)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
	at org.springframework.beans.factory.support.AbstractBeanFactory$$Lambda$337/1777443462.getObject(Unknown Source)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
	- locked <0x000000072146f420> (a java.util.concurrent.ConcurrentHashMap)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)

With the following state for task1 (the thread that was created to initialise the DB):

"task-1" #23 prio=5 os_prio=31 tid=0x00007f80944ca000 nid=0x480b waiting for monitor entry [0x00007000121de000]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:191)
	- waiting to lock <0x000000072146f420> (a java.util.concurrent.ConcurrentHashMap)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:134)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:404)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:361)
	at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.publishEventIfRequired(DataSourceInitializedPublisher.java:99)
	at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher.access$100(DataSourceInitializedPublisher.java:50)
	at org.springframework.boot.autoconfigure.orm.jpa.DataSourceInitializedPublisher$DataSourceSchemaCreatedPublisher.postProcessEntityManagerFactory(DataSourceInitializedPublisher.java:197)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:412)
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$$Lambda$803/1946962024.call(Unknown Source)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

created time in 3 days

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 7f84a92ef10158445798378a4fc4a1ca9a2bd56f

Document that Java 15 is supported Closes gh-23447

view details

Stephane Nicoll

commit sha 531690b8e1cbd8649ec0748ac6c671d70091a027

Merge branch '2.2.x' into 2.3.x Closes gh-23448

view details

Stephane Nicoll

commit sha 20193715f910fb8ea9630a38a976b85523b59b04

Merge branch '2.3.x'

view details

push time in 3 days

issue closedspring-projects/spring-boot

Document support for Java 15

Forward port of issue #23447 to 2.3.x.

closed time in 3 days

snicoll

issue closedspring-projects/spring-boot

Document support for Java 15

The 2.2 and 2.3 reference docs state that Boot "requires Java 8 and is compatible up to Java 14 (included)". We should update this to reflect that we now support Java 15.

closed time in 3 days

wilkinsona

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 7f84a92ef10158445798378a4fc4a1ca9a2bd56f

Document that Java 15 is supported Closes gh-23447

view details

Stephane Nicoll

commit sha 531690b8e1cbd8649ec0748ac6c671d70091a027

Merge branch '2.2.x' into 2.3.x Closes gh-23448

view details

push time in 3 days

issue openedspring-projects/spring-boot

Document support for Java 15

Forward port of issue #23447 to 2.3.x.

created time in 3 days

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 7f84a92ef10158445798378a4fc4a1ca9a2bd56f

Document that Java 15 is supported Closes gh-23447

view details

push time in 3 days

PR closed spring-projects/spring-framework

debug spring source status: waiting-for-triage
+92 -0

2 comments

5 changed files

gitkunming

pr closed time in 3 days

pull request commentspring-projects/spring-framework

debug spring source

@gitkunming please use your own fork for experiments.

gitkunming

comment created time in 3 days

issue commentspring-projects/spring-boot

Datasource initialisation with JPA schema configured in deferred mode happens asynchronously

Unfortunately, we can't switch to this as I thought as we send an event in that EMF lock and that leads to a deadlock in framework .

wikisamuel

comment created time in 3 days

issue commentspring-projects/spring-framework

Support interception of calls to the underlying cache

Thanks for the suggestion but we need to draw a line somewhere as the cache support in Spring Framework can't abstract the actual cache libraries too much. You already have that contract using a delegation pattern and a CacheResolver to return a wrapped Cache that does what you want.

davidkarlsen

comment created time in 3 days

issue closedspring-projects/spring-framework

Support interception of calls to the underlying cache

It would be nice if there was a pluggable mechanism (i.e. strategy interface) in order to intercept put/get to the underlying caches that the CacheManager interacts with.

This would allow for transforming read/writes in order to decrypt/encrypt the values.

There seems to be another user requesting the same at SO: https://stackoverflow.com/questions/46478798/how-to-write-custom-interceptor-for-spring-cachecachable

closed time in 3 days

davidkarlsen

push eventspring-projects/spring-boot

Stephane Nicoll

commit sha 1631ae23f5541753c9e83b529b356fc833535013

Allow RestTemplateBuilder to be further customized Closes gh-23389

view details

push time in 3 days

issue closedrzwitserloot/lombok

[BUG] Generated constructor does not provide sensible parameter names

Describe the bug The source model for a constructor that is made available to other annotation processors does not contain sensible parameter names. Consider the following example

package com.example.lombok.source.example;

import lombok.Data;

@Data
public class SampleData {

	private final String name;

	private final int description;

}

If an annotation processor runs after Lombok, it can access its constructor model. However, parameter names for the constructor are arg0 and arg1 respectively. It should be name and description instead.

To Reproduce

git clone https://github.com/snicoll-scratches/lombok-source-model.git
cd lombok-source-model
./mvnw clean install
cat lombok-source-model-sample/target/classes/lombok-source-model.properties

Expected behavior The output of that properties file should be:

SampleData.constructor.1.type=int
SampleData.constructor.0.type=java.lang.String
SampleData.constructor.1.name=description
SampleData.constructor.0.name=name

Version info (please complete the following information):

  • Lombok version: 1.18.10 (can be changed via -Dlombok.version`)
  • Platform openjdk version "1.8.0_202"

Additional context The Spring Boot project generates metadata for @ConfigurationProperties annotated type and has dedicated lombok support. Because the constructor does not expose relevant property names, the generated metadata does not match the source model and is currently invalid.

closed time in 3 days

snicoll

issue commentrzwitserloot/lombok

[BUG] Generated constructor does not provide sensible parameter names

I've tested a snapshot build of lombok and this issue has been fixed as a side effect of another fix, see https://github.com/spring-projects/spring-boot/issues/18730#issuecomment-694718102

snicoll

comment created time in 3 days

issue closedspring-projects/spring-boot

Property names are not available with Lombok and constructor binding

The output of the spring-boot-configuration-processor looks like below. It can't determine the names of any arguments. Those classes are standard classes with all final fields, annotated with lombok's @Data.

The issue only happens if the constructor is created by lombok and the class is annotated with @ConstructorBinding. If I create the constructor by hand, then it all works just fine. If I make the class mutable and remove @ConstructorBinding, it also works fine, even with a lombok-generated constructor.

{
  "groups": [
    {
      "name": "config.processor",
      "type": "io.app.config.ProcessorConfig",
      "sourceType": "io.app.config.ProcessorConfig"
    },
    {
      "name": "config.sender",
      "type": "io.app.config.SenderConfig",
      "sourceType": "io.app.config.SenderConfig"
    }
  ],
  "properties": [
    {
      "name": "config.processor.arg0",
      "type": "java.util.Map<java.lang.String,io.app.config.ProcessorConfig$InnerClasss>",
      "sourceType": "io.app.config.ProcessorConfig"
    },
    {
      "name": "config.sender.arg0",
      "type": "java.lang.Boolean",
      "sourceType": "io.app.config.SenderConfig"
    },
    {
      "name": "config.sender.arg1",
      "type": "java.lang.String",
      "sourceType": "io.app.config.SenderConfig"
    },
    {
      "name": "config.sender.arg2",
      "type": "java.lang.String",
      "sourceType": "io.app.config.SenderConfig"
    },
    {
      "name": "config.sender.arg3",
      "type": "java.lang.String",
      "sourceType": "io.app.config.SenderConfig"
    },
    {
      "name": "config.sender.arg4",
      "type": "java.lang.String",
      "sourceType": "io.app.config.SenderConfig"
    }
  ],
  "hints": []
}

closed time in 3 days

ghost

issue commentspring-projects/spring-boot

Property names are not available with Lombok and constructor binding

I've tested a snapshot of the lombok build and I confirm that the issue is fixed.

ghost

comment created time in 3 days

push eventspring-io/start.spring.io

Zhe Sun

commit sha 42308a82e73bdf21642137aa1e03e6fb09344e2c

Upgrade to Vaadin 14.3.7 See gh-540

view details

Stephane Nicoll

commit sha 333bf7bec8c32ca4dbce36f7ae80ce5703d21e48

Merge pull request #540 from ZheSun88 * pr/540: Upgrade to Vaadin 14.3.7 Closes gh-540

view details

push time in 3 days

PR closed spring-io/start.spring.io

Upgrade to Vaadin 14.3.7 type: entry-upgrade
+1 -1

0 comment

1 changed file

ZheSun88

pr closed time in 3 days

push eventspring-projects/spring-boot

dreis2211

commit sha fba1fb23e40bfc695a661674d9f94fce5635b78f

Fix multi-release JAR test on JDK 15 Backport of 54f93e9 See gh-23445

view details

Stephane Nicoll

commit sha 9b8866c45c4b8be3f252b082e2b4e28d7b79294a

Merge pull request #23445 from dreis2211 * pr/23445: Fix multi-release JAR test on JDK 15 Closes gh-23445

view details

Stephane Nicoll

commit sha 37ded9f6d340067e2bca767061b7362689edae33

Merge branch '2.2.x' into 2.3.x Closes gh-23446

view details

Stephane Nicoll

commit sha a7c411609ed0959e31b42b73cd8e62e10f08db1e

Merge branch '2.3.x'

view details

push time in 3 days

issue closedspring-projects/spring-boot

Fix multi-release JAR test on JDK 15

Forward port of issue #23445 to 2.3.x.

closed time in 3 days

snicoll

PR closed spring-projects/spring-boot

Fix multi-release JAR test on JDK 15 type: task

Hi,

this commit is a backport of 54f93e9 in order to fix the build pipeline on 2.2.x & 2.3.x

See gh-23433 See gh-21605

Cheers, Christoph

+1 -0

0 comment

1 changed file

dreis2211

pr closed time in 3 days

push eventspring-projects/spring-boot

dreis2211

commit sha fba1fb23e40bfc695a661674d9f94fce5635b78f

Fix multi-release JAR test on JDK 15 Backport of 54f93e9 See gh-23445

view details

Stephane Nicoll

commit sha 9b8866c45c4b8be3f252b082e2b4e28d7b79294a

Merge pull request #23445 from dreis2211 * pr/23445: Fix multi-release JAR test on JDK 15 Closes gh-23445

view details

Stephane Nicoll

commit sha 37ded9f6d340067e2bca767061b7362689edae33

Merge branch '2.2.x' into 2.3.x Closes gh-23446

view details

push time in 3 days

push eventspring-projects/spring-boot

dreis2211

commit sha fba1fb23e40bfc695a661674d9f94fce5635b78f

Fix multi-release JAR test on JDK 15 Backport of 54f93e9 See gh-23445

view details

Stephane Nicoll

commit sha 9b8866c45c4b8be3f252b082e2b4e28d7b79294a

Merge pull request #23445 from dreis2211 * pr/23445: Fix multi-release JAR test on JDK 15 Closes gh-23445

view details

push time in 3 days

more