I am using spring boot 2.0.5-RELEASE, and trying to use spring data Lovelace-M3 for it's MongoDB transaction support with MongoTransactionManager class, i added the lovelace-m3 dependency with release train repository as follow :
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Lovelace-M3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-libs-release</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
But maven doesn't download the jar of lovealace, only the pom, can't find anywhere lovelace classes. I don't know what i am missing here.
Milestone version does not publish on https://repo.spring.io/libs-release.
Please add the following code into your ...
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
Also, if you need to use milestones plugin, you can add the following code:
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Spring boot 2.0 does not support Spring data lovelace, if someone want to enjoy MongoDB 4 Transaction feature he needs to wait for Spring boot 2.1 unfortunately.
See : https://github.com/spring-projects/spring-boot/issues/14644
Related
I'm looking at the latest spring data documentation for mongo and it states:
Create a Time Series Collection derived from an Annotation
#TimeSeries(collection="weather", timeField = "timestamp")
public class Measurement {
String id;
Instant timestamp;
// ...
}
template.createCollection(Measurement.class);
However, I don't see #TimeSeries in any of the spring annotations. What dependency are they using here? I'm using spring boot framework, is it possible they updated spring data but not spring boot data?
What worked is to mimic the instructions on the springframework documentation with the latest snapshots of the spring boot packages.
Add the snapshots repositories to any pom that references the snapshot versions.
...
<repositories>
<repository>
<id>spring-snapshots</id>
<url>https://repo.spring.io/snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>https://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
Set the spring boot version, currently:
<spring.boot.version>2.6.0-SNAPSHOT</spring.boot.version>
Set the spring boot starter data mongodb version, currently:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>2.5.3</version>
</dependency>
Edit - if you're using Spring Cloud, your application will throw compatibility errors between the SNAPSHOT and Spring Cloud at run time unless you update your yaml config files with the following:
spring:
cloud:
compatibility-verifier:
enabled: false
The documentation has details of migration from 2.x to 3.x https://docs.spring.io/spring-data/mongodb/docs/current-SNAPSHOT/reference/html/#upgrading.2-3
However, i cannot find the 3.x maven dependency https://mvnrepository.com/artifact/org.springframework.data/spring-data-mongodb
The latest available is only 2.2.6.RELEASE
Is 3.x not available as of now?
The Spring Data Neumann Release is not GA yet. Please have a look at the wiki for more information on the planned timeline.
Release candidates and snapshot builds are available via repo.spring.io.
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>spring-milestones</id>
<name>libs-milestone</name>
<url>https://repo.spring.io/libs-milestone</url>
</repository>
<repository>
<snapshots />
<id>spring-snapshots</id>
<name>libs-snapshot</name>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>
Dont know whats wrong here. I cloned the project form the bitbucket repo. Upon importing the project as a existing maven project this is occuring
I think the problem is that you are using the snapshot version of the spring boot and these dependencies are not available on the maven central so have to add the additional repository address.
Add the following snippets in the <project> component in your pom.xml
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
I am trying to implement the pattern matching feature of spring cloud config based on the different profiles for an application. Based on the documentation in http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html#_environment_repository it is possible to match the repositories based on profiles. Below is my config server application.yml
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: ssh://xxxx#github/sample/cloud-config-properties.git
repos:
development:
pattern:
-*/development
-*/staging
uri: ssh://git#xxxgithub.com/development.git
test:
pattern:
-*/test
-*/perf
uri: ${HOME}/Documents/cloud-config-sample-test
I have an config client application "user" and have user.properties, user-development.properties, user-test.properties
Based on the documentation - irrespective of the application name , if the pattern matches */development i,e localhost:8888/user/development or localhost:8888/demo/development my config server should match the profile pattern and fetch the appropriate properties.
Ex: http://localhost:8888/demo/development
I should get demo-development.properties from ssh://git#xxxgithub.com/development.git
But in my application, the default uri is used for all the profiles i.e my property file demo.properties is returned from
uri: ssh://xxxx#github/sample/cloud-config-properties.git
Any pointers on this?
EDIT:
pom.xml
<parent>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-parent</artifactId>
<version>Brixton.M5</version>
<relativePath />
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-config-monitor</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-snapshots-continuous</id>
<name>Spring Snapshots Continuous</name>
<url>http://repo.spring.io/libs-snapshot-continuous-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>http://repo.spring.io/libs-release-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot-local</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone-local</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
after some debugging on the PatternMatching source code here is how I resolved the issue: You can choose one of the two ways.
application.yml
server:
port: 8888
spring:
cloud:
config:
server:
git:
uri: ssh://xxxx#github/sample/cloud-config-properties.git
repos:
development:
pattern: '*/development' ## give in quotes
uri: ssh://git#xxxgithub.com/development.git
OR
development:
pattern: xx*/development,*/development ##since it is not allowed to have a value starting with a wildcard( '*' )after pattern I first gave a generic matching but the second value is */development. Since pattern takes multiple values, the second pattern will match with the profile
uri: ssh://git#xxxgithub.com/development.git
pattern: */development.Error on yml file- expected alphabetic or numeric character, but found but found /.
The reason the profile pattern git repo was not identified because : although spring allows multiple array values for pattern beginning with a '-' in the yml file, the pattern matcher was taking the '-' as string to be matched. i.e it is looking for a pattern '-*/development' instead of '*/development'.
repos:
development:
pattern:
-*/development
-*/staging
Another issue i observed was, I was getting a compilation error on yml file if i had to mention the pattern array as '- */development' - note space after hyphen(which is meant to show that it can hold multiple values as array) and start with a '*/development' with an error: expected alphabetic or numeric character, but found but found /
repos:
development:
pattern:
- */development
- */staging
Below is a small part my pom.xml for SSO using SAML,
<properties>
<SAML-version>1.0.0-RC2-SNAPSHOT</SAML-version>
</properties>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>${SAML-version}</version>
</dependency>
for which STS(spring tool suite 3.1) throws below error continuosly,
"Missing artifact org.springframework.security.extensions:spring-security-saml2- core:jar:1.0.0-RC2-SNAPSHOT".
I navigated to maven repo and i can find the jar downloaded by maven.
Kindly help me.
Thanks,Selva
Add This
<repositories>
<repository>
<id>repo.springsource.org</id>
<name>repo.springsource.org-snapshots</name>
<url>http://repo.springsource.org/libs-snapshot</url>
</repository>
</repositories>
The Spring Security SAML website is currently incorrect.. The groupId should actually be org.springframework.security.extensions instead of just org.springframework.security.
The below dependency configuration works for me:
<dependencies>
<dependency>
<groupId>org.springframework.security.extensions</groupId>
<artifactId>spring-security-saml2-core</artifactId>
<version>1.0.0.RC2</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>