Getting 404 "Not Found" error from basic Spring Boot Camel REST DSL request - rest

I have been working on a basic demo of Camel and REST DSL for the past few days, but I have finally hit a brick wall with this issue. I am fairly new to Spring Boot's magic, so any feedback is much appreciated!
When I run the project, everything looks like it starts up correctly for my two routes. However, when I try a GET request, I always get a 404 "Not Found" message back.
The only two classes I have are in the same package, so I do not believe visibility would be the problem. I created the project as a Spring Start Project, and I run it as a Spring Boot application. The logs show that the two routes are started successfully, and Tomcat is using port 8080. The context path is specifically configured in the application.properties file.
My main application class:
package com.example.demo;
import org.apache.camel.CamelContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
#SpringBootApplication
#Configuration
#ComponentScan("com.example.demo")
public class DemoApplication {
#Autowired
CamelContext camelContext;
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
My router class:
package com.example.demo;
import org.springframework.stereotype.Component;
import org.apache.camel.LoggingLevel;
import org.apache.camel.model.rest.RestBindingMode;
import org.apache.camel.builder.RouteBuilder;
#Component
public class DemoCamelRouter extends RouteBuilder {
#Override
public void configure() throws Exception {
restConfiguration().component("servlet")
.bindingMode(RestBindingMode.auto);
rest().get("/hello")
.to("direct:hello");
from("direct:hello")
.log(LoggingLevel.INFO, "Hello World")
.transform().simple("Hello World");
}
}
My application.properties file:
camel.springboot.main-run-controller=true
server.servlet.context-path=/demo
I am testing this service using http://localhost:8080/demo/hello
Here are the Maven dependencies I have.
spring-boot-starter-web (managed:2.1.0.RELEASE)
spring-boot-starter-web-services (managed:2.1.0.RELEASE)
spring-boot-starter-test (managed:2.1.0.RELEASE)
camel-core: 2.22.2
camel-spring-boot-starter: 2.22.2
camel-servlet: 2.22.2
camel-http-common: 2.22.2
javax.servlet-api (managed:4.0.1)
Lastly, here is what the log shows.
2018-11-21 00:58:38.454 INFO 11072 --- [ main] o.a.camel.spring.boot.RoutesCollector : Starting CamelMainRunController to ensure the main thread keeps running
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route2 started and consuming from: direct://hello
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Route: route1 started and consuming from: servlet:/hello?httpMethodRestrict=GET
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Total 2 routes, of which 2 are started
2018-11-21 00:58:38.470 INFO 11072 --- [ main] o.a.camel.spring.SpringCamelContext : Apache Camel 2.22.2 (CamelContext: camel-1) started in 0.236 seconds
2018-11-21 00:58:38.486 INFO 11072 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '/demo'
2018-11-21 00:58:38.501 INFO 11072 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 3.882 seconds (JVM running for 6.868)
2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.a.c.c.C.[Tomcat].[localhost].[/demo] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2018-11-21 01:00:12.445 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2018-11-21 01:00:12.453 INFO 11072 --- [nio-8080-exec-4] o.s.web.servlet.DispatcherServlet : Completed initialization in 8 ms

As of Camel’s version 2.19, CamelServlet is by default set to “/camel”. So your url becomes:
http://localhost:8080/demo/camel/hello
Update:
You will also need to define following bean as you're using camel-servlet:
#Bean
public ServletRegistrationBean<Servlet> servletRegistrationBean() {
ServletRegistrationBean<Servlet> registration = new ServletRegistrationBean<>(new CamelHttpTransportServlet(), "/camel/*");
registration.setName("CamelServlet");
return registration;
}
Or instead of camel-servlet dependency, you should add camel-servlet-starter dependency

Related

Deploying Spring Boot App to Google App Engine - issues with connecting to SQL instance (PostgreSQL)

I have a Gradle based Spring Boot app that I'm trying to deploy to the App Engine via the App Engine gradle plugin. The SQL instance (PostgreSQL) is up and running fine, I can connect to it locally through DataGrip and it works fine. Here's my application.properties file:
spring.datasource.username=username
spring.datasource.password=password
spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
#################### GOOGLE CLOUD SETTINGS
spring.cloud.gcp.sql.enabled=true
spring.cloud.gcp.sql.database-name=db-name
spring.cloud.gcp.sql.instance-connection-name=app-name:europe-west2:db-name
When I try to deploy the app, I'm getting the following error (seems that it can't connect to the SQL instance):
A 2020-05-27T16:12:26.340839Z 2020-05-27 16:12:26.340 INFO 10 --- [ main] o.s.c.g.a.s.GcpCloudSqlAutoConfiguration : Default POSTGRESQL JdbcUrl provider. Connecting to jdbc:postgresql://google/db-name?socketFactory=com.google.cloud.sql.postgres.SocketFactory&cloudSqlInstance=instance-name:europe-west2:db-name with driver org.postgresql.Driver
A 2020-05-27T16:12:26.773138Z 2020-05-27 16:12:26.772 INFO 10 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
A 2020-05-27T16:12:26.977687Z 2020-05-27 16:12:26.977 INFO 10 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.15.Final
A 2020-05-27T16:12:27.413333Z 2020-05-27 16:12:27.413 INFO 10 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
A 2020-05-27T16:12:27.683594Z 2020-05-27 16:12:27.683 INFO 10 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
A 2020-05-27T16:12:27.760810Z 2020-05-27 16:12:27.760 INFO 10 --- [ main] c.g.cloud.sql.core.CoreSocketFactory : Connecting to Cloud SQL instance [app-name:europe-west2:db-name] via unix socket.
A 2020-05-27T16:12:27.966435Z 2020-05-27 16:12:27.966 WARN 10 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected
2020-05-27 17:12:27.970 BST
2020-05-27 16:12:27.970 INFO 10 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
I've researched this issue and it seems that this happens when the runtime classpath is different the compile class path. Problem is that I can't reproduce it locally and I can't figure out if it's a dependency that's causing this.
Full stack trace:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean (AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean (AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0 (AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean (AbstractApplicationContext.java:1108)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh (SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run (SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run (SpringApplication.java:1226)
at org.springframework.boot.SpringApplication.run (SpringApplication.java:1215)
at com.turbochargedapps.basketballappinternalrest.BasketballAppInternalRestApplication.main (BasketballAppInternalRestApplication.java:21)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:566)
at org.springframework.boot.loader.MainMethodRunner.run (MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch (Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch (Launcher.java:51)
at org.springframework.boot.loader.JarLauncher.main (JarLauncher.java:52)
Caused by: java.lang.IncompatibleClassChangeError: Found interface org.objectweb.asm.ClassVisitor, but class was expected
at jnr.ffi.provider.jffi.AsmLibraryLoader.generateInterfaceImpl (AsmLibraryLoader.java:104)
at jnr.ffi.provider.jffi.AsmLibraryLoader.loadLibrary (AsmLibraryLoader.java:89)
at jnr.ffi.provider.jffi.NativeLibraryLoader.loadLibrary (NativeLibraryLoader.java:44)
at jnr.ffi.LibraryLoader.load (LibraryLoader.java:325)
at jnr.unixsocket.Native.<clinit> (Native.java:80)
at jnr.unixsocket.UnixSocketChannel.<init> (UnixSocketChannel.java:101)
at jnr.unixsocket.UnixSocketChannel.open (UnixSocketChannel.java:65)
at com.google.cloud.sql.core.CoreSocketFactory.connect (CoreSocketFactory.java:180)
at com.google.cloud.sql.postgres.SocketFactory.createSocket (SocketFactory.java:71)
at org.postgresql.core.PGStream.<init> (PGStream.java:73)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect (ConnectionFactoryImpl.java:93)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl (ConnectionFactoryImpl.java:197)
at org.postgresql.core.ConnectionFactory.openConnection (ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init> (PgConnection.java:211)
at org.postgresql.Driver.makeConnection (Driver.java:459)
at org.postgresql.Driver.connect (Driver.java:261)
at com.zaxxer.hikari.util.DriverDataSource.getConnection (DriverDataSource.java:138)
at com.zaxxer.hikari.pool.PoolBase.newConnection (PoolBase.java:358)
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry (PoolBase.java:206)
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry (HikariPool.java:477)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast (HikariPool.java:560)
at com.zaxxer.hikari.pool.HikariPool.<init> (HikariPool.java:115)
at com.zaxxer.hikari.HikariDataSource.getConnection (HikariDataSource.java:112)
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection (DatasourceConnectionProviderImpl.java:122)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection (JdbcEnvironmentInitiator.java:180)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService (JdbcEnvironmentInitiator.java:68)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService (JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService (StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService (AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices (DefaultIdentifierGeneratorFactory.java:152)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies (AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService (AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService (AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init> (InFlightMetadataCollectorImpl.java:176)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete (MetadataBuildingProcess.java:118)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata (EntityManagerFactoryBuilderImpl.java:1214)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build (EntityManagerFactoryBuilderImpl.java:1245)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory (SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory (LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory (AbstractEntityManagerFactoryBean.java:391)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet (AbstractEntityManagerFactoryBean.java:378)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet (LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods (AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean (AbstractAutowireCapableBeanFactory.java:1792)
build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.2.0'
}
}
plugins {
id 'org.springframework.boot' version '2.2.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
id 'org.asciidoctor.convert' version '1.5.8'
id 'java'
}
apply plugin: 'com.google.cloud.tools.appengine'
appengine {
deploy {
appengine.deploy.version = "GCLOUD_CONFIG"
appengine.deploy.projectId = "GCLOUD_CONFIG"
}
}
group = 'com.group'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
ext {
set('snippetsDir', file("build/generated-snippets"))
set('springCloudVersion', "Hoxton.SR4")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
compile project(':project-core-submodule')
compile group: 'com.jayway.jsonpath', name: 'json-path', version: '2.0.0'
testImplementation('org.springframework.boot:spring-boot-starter-test') {
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}
testImplementation 'org.springframework.restdocs:spring-restdocs-mockmvc'
testImplementation 'org.springframework.security:spring-security-test'
testCompile group: 'com.h2database', name: 'h2', version: '1.4.200'
compile 'io.jsonwebtoken:jjwt-api:0.11.1'
runtime 'io.jsonwebtoken:jjwt-impl:0.11.1',
// Uncomment the next line if you want to use RSASSA-PSS (PS256, PS384, PS512) algorithms:
//'org.bouncycastle:bcprov-jdk15on:1.60',
'io.jsonwebtoken:jjwt-jackson:0.11.1' // or 'io.jsonwebtoken:jjwt-gson:0.11.1' for gson
// https://mvnrepository.com/artifact/com.google.guava/guava
compile group: 'com.google.guava', name: 'guava', version: '29.0-jre'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
compile group: 'org.springframework.cloud', name: 'spring-cloud-gcp-starter-sql-postgresql'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
test {
outputs.dir snippetsDir
useJUnitPlatform()
}
asciidoctor {
inputs.dir snippetsDir
dependsOn test
}
Any ideas?
Turns out it was Google Guava that was causing this issue - I simply removed the dependency from my build.gradle file, did gradle clean build and then redeployed!

Spring Cloud config client not picking values from Config server

My Config client is not picking the property values from config
server.
http://localhost:8888/customer_service/default
Above Config server endpoint is returning proper values for Config client,
{
"name": "customer_service",
"profiles": [
"default"
],
"label": null,
"version": "c7648db5662dc65aeaad9c91abbf58b41010be7c",
"state": null,
"propertySources": [
{
"name": "https://github.com/prasadrpm/MicroService_config.git/customer_service.properties",
"source": {
"customer.config.location": "XXXX",
"customer.config.name": "YYYY"
}
}
]
}
Config client bootstrap.properties
server.port=8080
spring.application.name=customer_service
spring.cloud.config.enabled=true
spring.cloud.config.name=config_server
spring.cloud.config.uri=http://localhost:8888
Config client Log
2020-04-10 16:47:00.725 INFO 14976 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2020-04-10 16:47:03.267 INFO 14976 --- [ main] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config_server, profiles=[default], label=null, version=c7648db5662dc65aeaad9c91abbf58b41010be7c, state=null
2020-04-10 16:47:03.269 INFO 14976 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}]
2020-04-10 16:47:03.280 INFO 14976 --- [ main] com.customer.CustomerServiceApplication : No active profile set, falling back to default profiles: default
...
2020-04-10 16:47:05.164 INFO 14976 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1860 ms
2020-04-10 16:47:05.549 WARN 14976 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'customer.config.location' in value "${customer.config.location}"
2020-04-10 16:47:05.552 INFO 14976 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2020-04-10 16:47:05.577 INFO 14976 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-04-10 16:47:05.595 ERROR 14976 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'customerController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'customer.config.location' in value "${customer.config.location}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.5.RELEASE.jar:5.2.5.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[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]
The URL that returns you correct properties/configuration is: localhost:8888/customer_service/default
Client application is querying for properties based on following data:
c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
c.c.c.ConfigServicePropertySourceLocator : Located environment: name=config_server, profiles=[default], label=null, version=c7648db5662dc65aeaad9c91abbf58b41010be7c, state=null
b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}]
com.customer.CustomerServiceApplication : No active profile set, falling back to default profiles: default
...
So, effectively, client application is calling:
localhost:8888/config_server/default
So, there are two solutions:
delete spring.cloud.config.name=config_server property in bootstrap.properties, and your application should be able to fetch properties.
update value of spring.cloud.config.name to customer_service service. But if you do not provide spring.cloud.config.name explicitly, then client will use spring.application.name as the default value for spring.cloud.config.name.
What annotation you had used here?
It can be easily retrieved like this.
#Value("${customer.config.location}")
private String someOtherProperty;
and it is not needed
spring.cloud.config.name=config_server

SpringBoot cannot find handler method to register mongdb requests

I have a spring boot app which is trying to connect to Mongo DB, however none of my requests seem to get mapped.
My console log looks like this.
2020-03-03 16:48:57.866 INFO 2100 --- [ main] com.ebay.queens.demo.SpringBootMain : Starting SpringBootMain on DESKTOP-BJ4TA7J with PID 2100 (started by user in C:\Users\user\Documents\Beng Software Engineering\CSC3032-Software Engineering Project\backend)
2020-03-03 16:48:57.872 INFO 2100 --- [ main] com.ebay.queens.demo.SpringBootMain : No active profile set, falling back to default profiles: default
2020-03-03 16:48:59.428 INFO 2100 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2020-03-03 16:48:59.488 INFO 2100 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 49ms. Found 0 repository interfaces.
2020-03-03 16:49:02.977 INFO 2100 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 9000 (http)
2020-03-03 16:49:03.094 INFO 2100 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2020-03-03 16:49:03.095 INFO 2100 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.26]
2020-03-03 16:49:03.468 INFO 2100 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2020-03-03 16:49:03.468 INFO 2100 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 5447 ms
2020-03-03 16:49:03.494 INFO 2100 --- [ main] com.ebay.queens.demo.TokenUtilityClass : Token Utility Class
PRD-38907625e4e8-b6b8-4c83-b069-68ac
2020-03-03 16:49:03.577 INFO 2100 --- [ Timer] com.ebay.queens.demo.TokenUtilityClass : Authentication Token
2020-03-03 16:49:04.369 INFO 2100 --- [ main] com.ebay.queens.demo.Login : Login
2020-03-03 16:49:04.371 INFO 2100 --- [ main] com.ebay.queens.demo.SignUp : SignUp
2020-03-03 16:49:05.453 INFO 2100 --- [ Timer] com.ebay.queens.demo.TokenUtilityClass : A21AAEEVZG6qL6IdhIDPRgFdjGFi00knDwdZsJUdkPsKV9g9sI8Q7R0tv4PKtwV53KkUlagV6QsDI5T53RPb4bhJwUkIwb8Cg
2020-03-03 16:49:05.613 INFO 2100 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], mode=MULTIPLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2020-03-03 16:49:05.613 INFO 2100 --- [ main] org.mongodb.driver.cluster : Adding discovered server localhost:27017 to client view of cluster
2020-03-03 16:49:05.754 INFO 2100 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue:17}] to localhost:27017
2020-03-03 16:49:05.762 INFO 2100 --- [localhost:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 2, 3]}, minWireVersion=0, maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=5458000}
2020-03-03 16:49:05.764 INFO 2100 --- [localhost:27017] org.mongodb.driver.cluster : Discovered cluster type of STANDALONE
2020-03-03 16:49:05.844 WARN 2100 --- [ main] o.s.data.convert.CustomConversions : Registering converter from class java.time.LocalDateTime to class java.time.Instant as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:05.845 WARN 2100 --- [ main] o.s.data.convert.CustomConversions : Registering converter from class java.time.Instant to class java.time.LocalDateTime as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:06.059 WARN 2100 --- [ main] o.s.data.convert.CustomConversions : Registering converter from class java.time.LocalDateTime to class java.time.Instant as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:06.059 WARN 2100 --- [ main] o.s.data.convert.CustomConversions : Registering converter from class java.time.Instant to class java.time.LocalDateTime as reading converter although it doesn't convert from a store-supported type! You might wanna check you annotation setup at the converter implementation.
2020-03-03 16:49:06.642 INFO 2100 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 9000 (http) with context path ''
2020-03-03 16:49:06.646 INFO 2100 --- [ main] com.ebay.queens.demo.SpringBootMain : Started SpringBootMain in 9.677 seconds (JVM running for 10.521)
2020-03-03 16:49:06.648 INFO 2100 --- [ main] com.ebay.queens.demo.TokenUtilityClass : Token Utility Class
2020-03-03 16:49:06.648 INFO 2100 --- [ main] com.ebay.queens.demo.Paypal : Paypal Class
2020-03-03 16:49:06.653 INFO 2100 --- [ main] com.ebay.queens.demo.Version1Api : Version 1 API
and and my controller class looks like this
package com.ebay.queens.demo.resource;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ebay.queens.demo.User;
import com.ebay.queens.repository.UserRepository;
#RestController
public class UserController {
#Autowired
private UserRepository userRepository;
#PostMapping("/AddUser")
public String saveUser(#RequestBody User user) {
userRepository.save(user);
return "Added user with id: " + user.getId();
}
#GetMapping("/all")
public List<User> getAll(){
List<User> users = this.userRepository.findAll();
return users;
}
}
I have tried reshuffling the packages around but not getting any luck.
Would anyone have any suggestions?

Using 2 different Papyrus UMLstatemachines with the spring-statemachine project

Link to the project on github for testing
The Payprus Files are here
I'm trying to make a State-Machine with Papyrus. The State Machine should combine two single state-machines to one, as you can see in the first image:
the state machine 1 is defined in the 2nd picture and the state machine 2 is defined in the 3rd picture
I'm consuming the UML with my spring application (scroll down for code)
I tried this with a real simple single state machine (so only something like state machine 1 but with initial and final point) and it worked perfectly, the System.out.println() was writing the whole code.
But with this 2 state machines, the machine starts in the TOP at the top_inital point and goes then to top_s1. This was expected and working
Than i expected to go over the topExitPoint1 to the sm1EntryPoint -> entering the StateMachine1 -> than to StateMachine2 -> back to top and so on.
But unfortunately the only state in my machine which was used has been the one in top -> the top_s1 state.
The console log only shows me this:
2017-09-14 17:41:42.002 INFO 25414 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2017-09-14 17:41:42.008 INFO 25414 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 0
State change to top_s1
2017-09-14 17:41:42.070 INFO 25414 --- [ main] o.s.s.support.LifecycleObjectSupport : started org.springframework.statemachine.support.DefaultStateMachineExecutor#4afd21c6
2017-09-14 17:41:42.070 INFO 25414 --- [ main] o.s.s.support.LifecycleObjectSupport : started top_s1 topFinalState top_r2_s1 top_s2 top_FinalState1 sm2_s1 sm2_s2 sm1_s2 sm1_s1 / top_s1 / uuid=e3a76fb9-5d3f-46b2-9c01-17d23eabedea / id=null
2017-09-14 17:41:42.071 INFO 25414 --- [ main] d.j.u.UmlSpringStateMachineApplication : Started UmlSpringStateMachineApplication in 2.584 seconds (JVM running for 2.85)
2017-09-14 17:41:42.073 INFO 25414 --- [ Thread-3] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#1e4a7dd4: startup date [Thu Sep 14 17:41:39 CEST 2017]; root of context hierarchy
2017-09-14 17:41:42.076 INFO 25414 --- [ Thread-3] o.s.c.support.DefaultLifecycleProcessor : Stopping beans in phase 0
2017-09-14 17:41:42.077 INFO 25414 --- [ Thread-3] o.s.s.support.LifecycleObjectSupport : stopped org.springframework.statemachine.support.DefaultStateMachineExecutor#4afd21c6
2017-09-14 17:41:42.078 INFO 25414 --- [ Thread-3] o.s.s.support.LifecycleObjectSupport : stopped top_s1 topFinalState top_r2_s1 top_s2 top_FinalState1 sm2_s1 sm2_s2 sm1_s2 sm1_s1 / / uuid=e3a76fb9-5d3f-46b2-9c01-17d23eabedea / id=null
2017-09-14 17:41:42.078 INFO 25414 --- [ Thread-3] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
2017-09-14 17:41:42.079 INFO 25414 --- [ Thread-3] o.s.s.support.LifecycleObjectSupport : destroy called
I tried so many things in Papyrus to change this behaviour, but nothing changes.
Would be cool, if someone can have a look to it, and maybe knows how to help.
Here is the Java Code: My UmlSpringStateMachineApplication
package de.joergi.umlspringstatemachine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.statemachine.StateMachine;
#SpringBootApplication
public class UmlSpringStateMachineApplication implements CommandLineRunner {
#Autowired
private StateMachine<String, String> stateMachine;
public static void main(String[] args) {
SpringApplication.run(UmlSpringStateMachineApplication.class, args);
}
#Override
public void run(String... args) throws Exception {
stateMachine.start();
}
}
and my StateMachineConfig looks like this:
package de.joergi.umlspringstatemachine;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.statemachine.config.EnableStateMachine;
import org.springframework.statemachine.config.StateMachineConfigurerAdapter;
import org.springframework.statemachine.config.builders.StateMachineConfigurationConfigurer;
import org.springframework.statemachine.config.builders.StateMachineModelConfigurer;
import org.springframework.statemachine.config.model.StateMachineModelFactory;
import org.springframework.statemachine.listener.StateMachineListener;
import org.springframework.statemachine.listener.StateMachineListenerAdapter;
import org.springframework.statemachine.state.State;
import org.springframework.statemachine.uml.UmlStateMachineModelFactory;
#Configuration
#EnableStateMachine
public class StateMachineConfig extends StateMachineConfigurerAdapter<String, String> {
#Override
public void configure(StateMachineConfigurationConfigurer<String, String> config) throws Exception {
config.withConfiguration().autoStartup(false).listener(listener());
}
#Override
public void configure(StateMachineModelConfigurer<String, String> model) throws Exception {
model.
withModel().factory(modelFactoryStateMachine());
}
#Bean
public StateMachineModelFactory<String, String> modelFactoryStateMachine() {
return new UmlStateMachineModelFactory("classpath:papyrus/new_test.uml");
}
#Bean
public StateMachineListener<String, String> listener() {
return new StateMachineListenerAdapter<String, String>() {
#Override
public void stateChanged(State<String, String> from, State<String, String> to) {
System.out.println("State change to " + to.getId());
}
};
}
}
If you want to see how the model explorer looks like:
So, i fixed this, with building two separate State-Machines together in one project and connecting them
https://github.com/joergi/uml-spring-state-machine/ see the new push to master

Spring Batch - the batch works in Eclipse but not as a JAR - without explicit DEBUG log

I am new to Spring. My batch works in Eclipse using Spring Boot.
public class Main {
public static void main(String [] args) {
System.exit(SpringApplication.exit(SpringApplication.run(BatchConfiguration.class, args)));
}
}
Here are the Eclipse's logs.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.4.RELEASE)
2014-08-08 12:01:09.714 INFO 292 --- [ main] f.i.a.fczeuj.springbatch.Main : Starting Main on W100023928 with PID 292 (started by Me in D:\Eclipse_workspace\SpringBatchJavaConfig)
2014-08-08 12:01:09.776 INFO 292 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#714ae2c1: startup date [Fri Aug 08 12:01:09 CEST 2014]; root of context hierarchy
2014-08-08 12:01:10.494 INFO 292 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'org.springframework.boot.autoconfigure.AutoConfigurationPackages': replacing [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] with [Generic bean: class [org.springframework.boot.autoconfigure.AutoConfigurationPackages$BasePackages]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null]
2014-08-08 12:01:10.979 WARN 292 --- [ main] o.s.c.a.ConfigurationClassEnhancer : #Bean method ScopeConfiguration.stepScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as #Autowired, #Resource and #PostConstruct within the method's declaring #Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see #Bean Javadoc for complete details
2014-08-08 12:01:10.994 WARN 292 --- [ main] o.s.c.a.ConfigurationClassEnhancer : #Bean method ScopeConfiguration.jobScope is non-static and returns an object assignable to Spring's BeanFactoryPostProcessor interface. This will result in a failure to process annotations such as #Autowired, #Resource and #PostConstruct within the method's declaring #Configuration class. Add the 'static' modifier to this method to avoid these container lifecycle issues; see #Bean Javadoc for complete details
2014-08-08 12:01:11.166 INFO 292 --- [ main] o.s.j.d.DriverManagerDataSource : Loaded JDBC driver: org.postgresql.Driver
sql=insert into schema_batch_01.table_batch_donnees_massives values (:num_ligne,(((extract('epoch' from statement_timestamp())*1000)::bigint)-1407492071384)/1000,:prenom, :nom, :rue, :ville, :etat)
2014-08-08 12:01:11.618 INFO 292 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executing SQL script from class path resource [org/springframework/batch/core/schema-postgresql.sql]
2014-08-08 12:01:11.619 INFO 292 --- [ main] o.s.jdbc.datasource.init.ScriptUtils : Executed SQL script from class path resource [org/springframework/batch/core/schema-postgresql.sql] in 1 ms.
2014-08-08 12:01:11.822 INFO 292 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2014-08-08 12:01:11.838 INFO 292 --- [ main] o.s.b.a.b.JobLauncherCommandLineRunner : Running default command line with: []
2014-08-08 12:01:11.884 INFO 292 --- [ main] o.s.b.c.r.s.JobRepositoryFactoryBean : No database type set, using meta data indicating: POSTGRES
2014-08-08 12:01:12.025 INFO 292 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : No TaskExecutor has been set, defaulting to synchronous executor.
2014-08-08 12:01:12.493 INFO 292 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=job1]] launched with the following parameters: [{run.id=28}]
2014-08-08 12:01:12.664 INFO 292 --- [ main] o.s.batch.core.job.SimpleStepHandler : Executing step: [taskletTruncate]
truncateDonnees DataSource=
org.springframework.jdbc.datasource.DriverManagerDataSource#7e913c56
Username=
role_cnx_batch_seminaire_dev
2014-08-08 12:01:13.102 INFO 292 --- [ main] o.s.batch.core.job.SimpleStepHandler : Executing step: [stepInserts]
2014-08-08 12:01:18.079 INFO 292 --- [ main] o.s.b.c.l.support.SimpleJobLauncher : Job: [SimpleJob: [name=job1]] completed with the following parameters: [{run.id=28}] and the following status: [COMPLETED]
2014-08-08 12:01:18.079 INFO 292 --- [ main] f.i.a.fczeuj.springbatch.Main : Started Main in 8.677 seconds (JVM running for 9.239)
2014-08-08 12:01:18.079 INFO 292 --- [ main] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext#714ae2c1: startup date [Fri Aug 08 12:01:09 CEST 2014]; root of context hierarchy
2014-08-08 12:01:18.079 INFO 292 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown
So I have built a JAR with maven dependencies and main class in the MANIFEST and run the JAR
java -jar myArchive.jar
But the JAR does nothing, without ERRORS in the DOS logs.
2014-08-08 12:10:47.125 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'batchConfiguration'
sql=insert into schema_batch_01.table_batch_donnees_massives values (:num_ligne,(((extract('epoch' from statement_timestamp())*1000)::bigint)-1407492647125)/1000,:prenom, :nom
, :rue, :ville, :etat)
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Eagerly caching bean 'writer' to allow for resolving potential circular refere
nces
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Invoking afterPropertiesSet() on bean with name 'writer'
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Finished creating instance of bean 'writer'
2014-08-08 12:10:47.141 DEBUG --- [ main] s.c.a.AnnotationConfigApplicationContext : Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using defa
ult [org.springframework.context.support.DefaultLifecycleProcessor#4dc1c92b]
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'lifecycleProcessor'
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemProperties]
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [systemEnvironment]
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Searching for key 'spring.liveBeansView.mbeanDomain' in [class path resource [
spring.batch.context.properties]]
2014-08-08 12:10:47.141 DEBUG --- [ main] o.s.c.e.PropertySourcesPropertyResolver : Could not find key 'spring.liveBeansView.mbeanDomain' in any property source.
Returning [null]
2014-08-08 12:10:47.157 INFO --- [ main] f.i.a.fczeuj.springbatch.Main : Started Main in 0.952 seconds (JVM running for 1.264)
2014-08-08 12:10:47.157 INFO --- [ main] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationCont
ext#356f144c: startup date [Fri Aug 08 12:10:46 CEST 2014]; root of context hierarchy
2014-08-08 12:10:47.157 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Returning cached instance of singleton bean 'lifecycleProcessor'
2014-08-08 12:10:47.157 DEBUG --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Destroying singletons in org.springframework.beans.factory.support.DefaultList
ableBeanFactory#11e7c5cb: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowi
redAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,batc
hConfiguration,org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor,org.springframework.context.annotation.ConfigurationClassPostProcess
or.enhancedConfigurationProcessor,org.springframework.batch.core.configuration.annotation.ScopeConfiguration,stepScope,jobScope,org.springframework.batch.core.configuration.an
notation.SimpleBatchConfiguration,jobRepository,jobLauncher,jobRegistry,jobExplorer,transactionManager,jobBuilders,stepBuilders,fr.insee.architecture.fczeuj.springbatch.Contex
tWithProperties,dataSource,nbIteration,org.springframework.boot.autoconfigure.AutoConfigurationPackages,taskletTruncate,reader,processor,writer,job,stepInserts]; root of facto
ry hierarchy
2014-08-08 12:10:47.157 DEBUG --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'batchConfiguration'
2014-08-08 12:10:47.157 DEBUG --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'org.springframework.batch.core.configura
tion.annotation.SimpleBatchConfiguration'
2014-08-08 12:10:47.157 DEBUG --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'fr.architecture.springbatch
.ContextWithProperties'
2014-08-08 12:10:47.157 DEBUG --- [ main] o.s.b.f.support.DisposableBeanAdapter : Invoking destroy() on bean with name 'org.springframework.batch.core.configura
tion.annotation.ScopeConfiguration'
the missing logs between the JAR and Eclipse is just after the log line :
sql=insert into schema_batch_01.table_batch_donnees_massives values (:num_ligne,(((extract('epoch' from statement_timestamp())*1000)::bigint)-1407492647125)/1000,:prenom, :nom
, :rue, :ville, :etat)
Do you have an idea why my JAR aborts without running the Job ? Thank you.
Are you building with maven? If so, using the maven-assembly-plugin does not result in a jar file that runs the batch job, you'll need to use the spring-boot-maven-plugin like this:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.1.4.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>your.MainClass</mainClass>
</configuration>
</plugin>
</plugins>
</build>
You can then use the standard "mvn clean package" command to get an executable jar that contains all necessary dependencies and the correct manifest file.