spring-projects / spring-boot Goto Github PK
View Code? Open in Web Editor NEWSpring Boot
Home Page: https://spring.io/projects/spring-boot
License: Apache License 2.0
Spring Boot
Home Page: https://spring.io/projects/spring-boot
License: Apache License 2.0
In Spring Boot 0.5.0.M5 (from the homebrew tap), the --local
option no longer accumulates grapes in the $PWD/.grapes
folder. It would appear that the dependencies are being accumulated in their default location of $HOME/.gradle/grapes
. To reproduce this issue simply run the 'quick start sample' with --local
.
java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b106)
Java HotSpot(TM) 64-Bit Server VM (build 25.0-b48, mixed mode)
Spring boot version: 0.5.0.M5
Stacktrace:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':repackage'.
> java.lang.IllegalArgumentException (no error message)
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':repackage'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:283)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$1.run(DefaultTaskPlanExecutor.java:33)
at org.gradle.internal.Factories$1.create(Factories.java:22)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:214)
at org.gradle.cache.internal.DefaultCacheAccess.longRunningOperation(DefaultCacheAccess.java:276)
at org.gradle.cache.internal.DefaultPersistentDirectoryStore.longRunningOperation(DefaultPersistentDirectoryStore.java:142)
at org.gradle.api.internal.changedetection.state.DefaultTaskArtifactStateCacheAccess.longRunningOperation(DefaultTaskArtifactStateCacheAccess.java:78)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:31)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:166)
at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)
at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)
at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)
at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)
at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
at org.gradle.launcher.Main.doAction(Main.java:46)
at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
at org.gradle.launcher.Main.main(Main.java:37)
at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)
at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)
at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:58)
Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.springframework.boot.loader.tools.MainClassFinder.isMainClass(MainClassFinder.java:181)
at org.springframework.boot.loader.tools.MainClassFinder.findMainClass(MainClassFinder.java:142)
at org.springframework.boot.loader.tools.Repackager.buildManifest(Repackager.java:170)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:133)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:116)
at org.springframework.boot.loader.tools.Repackager.repackage(Repackager.java:87)
at org.springframework.boot.gradle.task.Repackage$1.execute(Repackage.java:55)
at org.springframework.boot.gradle.task.Repackage$1.execute(Repackage.java:1)
at org.gradle.api.internal.Actions$FilteredAction.execute(Actions.java:203)
at org.gradle.api.internal.DefaultDomainObjectCollection.all(DefaultDomainObjectCollection.java:110)
at org.gradle.api.internal.DefaultDomainObjectCollection.withType(DefaultDomainObjectCollection.java:120)
at org.springframework.boot.gradle.task.Repackage.repackage(Repackage.java:46)
at org.gradle.util.JavaMethod.invoke(JavaMethod.java:62)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:219)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:212)
at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:201)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:527)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:510)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
... 52 more
./gradlew clean build
fails with an IllegalArgumentException
out of ASM's ClassReader, as called from Boot's MainClassFinder on Java 1.8.
In order for Spring Boot to be added to GVM, the binary zip file needs to comply with certain conventions. All technology currently supported by GVM is delivered in a zip file named as follows: ${name}-${version}-${freeform}.zip
For spring boot, it would be spring-boot-0.5.0.M1-bin.zip
.
Internally, it would contain a folder named ${name}-${version}
as: spring-boot-0.5.0.M1
.
If these minor changes could be made in the zip distro, I can proceed in adding it to gvm.
These two commands have overlap. Look for any refactoring, possibly some utility functions, that are repeated.
I am starting my application with
public static void main(final String[] args) {
...
SpringApplication sa = new SpringApplication(new Object[] {
"classpath:path/my-context.xml"
});
sa.run(args);
..
It works if I run it with ./gradle run
or start it from Eclipse.
The default class loader of the thread that runs main() is sun.misc.Launcher$AppClassLoader
in this case.
When I use spring-boot-gradle-plugin and packge the application with it then when run with java -jar myapp.jar
the application crashes on startup with
2013-08-30 12:04:20,482 797 ERROR [main] com.myapp.Main - Unexpected error
java.lang.IllegalArgumentException: name
at sun.misc.URLClassPath$Loader.getResource(URLClassPath.java:525) ~[na:1.7.0_17]
at sun.misc.URLClassPath.getResource(URLClassPath.java:195) ~[na:1.7.0_17]
at java.net.URLClassLoader$1.run(URLClassLoader.java:358) ~[na:1.7.0_17]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_17]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_17]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_17]
at org.springframework.boot.loader.LaunchedURLClassLoader.findClass(LaunchedURLClassLoader.java:57) ~[rti-t-http-1.0.0.BUILD-SNAPSHOT.jar!/:na]
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_17]
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0_17]
at org.springframework.util.ClassUtils.forName(ClassUtils.java:241) ~[spring-core-4.0.0.M3.jar!/:4.0.0.M3]
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:162) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar!/:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:134) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar!/:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.BeanDefinitionLoader.load(BeanDefinitionLoader.java:117) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar!/:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.load(SpringApplication.java:469) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar!/:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:280) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar!/:0.5.0.BUILD-SNAPSHOT]
at com.myapp.Main.main(Main.java:99) ~[myapp-1.0.0.BUILD-SNAPSHOT.jar!/:na]
That happens because spring-boot-gradle plugin packs the application in such way the the org.springframework.boot.loader.LaunchedURLClassLoader
becomes the default main() thread classloader. It delegated an attempt to load a class with name classpath:path/my-context.xml
to its parent class URLClassLoader which throws IllegalArgumentException
instead of anticipated ClassNotFoundException
in the org.springframework.boot.BeanDefinitionLoader
. Thus the exception is not being intercepted, propagates up the stack and crashes the application on startup.
Right now, CLI detection of Rabbit vs. JMS requires a special annotation for each, due to name collisions of SimpleMessageLIstenerContainer.
With those changes, we can deprecate the @EnableRabbitMessaging and @EnableJmsMessaging annotations and eventually remove them.
using actuator in a spring-boot-web project using a custom WebSecurityConfigurerAdapter (@Configuration/@EnableWebSecurity), it seems as if the actuator security auto-config overrides the applications security config.
Currently, using the default auto-configuration for Spring Security, if the user sets security.management.enabed=false
(I did it via the YAML, but it should work using any method) the security will be disabled for all endpoints, including the application endpoints.
Currently the value of spring.database.username defaults to sa
at all times. If you choose to use a different database that doesn't require a username (Postgres for example, can authenticate by process owner), there isn't a great way to indicate that you want to use no username.
The following fails with FATAL: rolde "sa" does not exist
which stands to reason.
---
spring:
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost/test
The following fails with FATAL: no PostgreSQL username specified in startup packet
which again matches expectations because it's not that the username is empty, it's that it shouldn't be set at all.
---
spring:
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost/test
username:
A workaround at the moment is to use the $USER
or user.name
.
---
spring:
datasource:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://localhost/test
username: ${user.name}
This work around isn't ideal and I think that boot shouldn't use the sa
default if it hasn't also defaulted the url. Arguably, the defaulting of org.h2.Driver
shouldn't happen for the same reasons.
I have two different implementations of a service interface X, each are annotated respectively with @service and @Profile (A and B respectively).
Another service Y has X injected.
application.properties has a property
spring.active.profiles=A
On start up neither service implementation is constructed and results in a failure to Autowire into service Y.
Not sure whether this is an error on my part or a bug in the spring boot code.
Thanks
Adrian
I have a spring-boot driven application that launches embedded Tomcat.
It starts and works fine.
I add the following dependencies to the project (nothing more):
compile "org.springframework.security:spring-security-core:3.2.0.RC1"
compile "org.springframework.security:spring-security-web:3.2.0.RC1"
compile "org.springframework.security:spring-security-config:3.2.0.RC1"
And the application crashes on startup with
Caused by: java.lang.ClassNotFoundException: org.springframework.security.config.annotation.web.configurers.SessionCreationPolicy
Here is the full exception stack:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfigurerAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$BoostrapWebSecurityConfigurerAdapter.security; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.actuate.properties.SecurityProperties' defined in class path resource [org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:291) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1139) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:354) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1048) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:200) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:446) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getOrderedBeansOfType(EmbeddedWebApplicationContext.java:335) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.getServletContextInitializerBeans(EmbeddedWebApplicationContext.java:248) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext$1.onStartup(EmbeddedWebApplicationContext.java:193) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.context.embedded.tomcat.ServletContextInitializerLifecycleListener.lifecycleEvent(ServletContextInitializerLifecycleListener.java:54) ~[spring-boot-0.5.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) ~[tomcat-embed-core-8.0.0-RC1.jar:8.0.0-RC1]
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90) [tomcat-embed-core-8.0.0-RC1.jar:8.0.0-RC1]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5178) ~[tomcat-embed-core-8.0.0-RC1.jar:8.0.0-RC1]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [tomcat-embed-core-8.0.0-RC1.jar:8.0.0-RC1]
... 7 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(java.util.List) throws java.lang.Exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfigurerAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$BoostrapWebSecurityConfigurerAdapter.security; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.actuate.properties.SecurityProperties' defined in class path resource [org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:604) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
... 32 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'webSecurityConfigurerAdapter': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$BoostrapWebSecurityConfigurerAdapter.security; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.actuate.properties.SecurityProperties' defined in class path resource [org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:291) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1139) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:931) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:832) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:789) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:561) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
... 34 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$BoostrapWebSecurityConfigurerAdapter.security; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.actuate.properties.SecurityProperties' defined in class path resource [org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
... 45 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.actuate.properties.SecurityProperties' defined in class path resource [org/springframework/boot/actuate/autoconfigure/SecurityAutoConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:584) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1048) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:299) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:295) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:195) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:931) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:874) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:789) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
... 47 common frames omitted
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.boot.actuate.properties.SecurityProperties org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:188) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:573) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
... 59 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/security/config/annotation/web/configurers/SessionCreationPolicy
at org.springframework.boot.actuate.properties.SecurityProperties.<init>(SecurityProperties.java:34) ~[spring-boot-actuator-0.5.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration.securityProperties(SecurityAutoConfiguration.java:90) ~[spring-boot-actuator-0.5.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$$EnhancerByCGLIB$$2fe99fae.CGLIB$securityProperties$0(<generated>) ~[spring-core-4.0.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$$EnhancerByCGLIB$$2fe99fae$$FastClassByCGLIB$$31fd4fc3.invoke(<generated>) ~[spring-core-4.0.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228) ~[spring-core-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334) ~[spring-context-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
at org.springframework.boot.actuate.autoconfigure.SecurityAutoConfiguration$$EnhancerByCGLIB$$2fe99fae.securityProperties(<generated>) ~[spring-core-4.0.0.BUILD-SNAPSHOT.jar:0.5.0.BUILD-SNAPSHOT]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_17]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_17]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_17]
at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_17]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:166) ~[spring-beans-4.0.0.BUILD-SNAPSHOT.jar:4.0.0.BUILD-SNAPSHOT]
... 60 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.springframework.security.config.annotation.web.configurers.SessionCreationPolicy
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_17]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_17]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_17]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_17]
at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_17]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_17]
at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0_17]
... 72 common frames omitted
spring-security-javaconfig is being depreciated in favor of spring-security-config. Additionally, neither dependency worked as shown in the Actuator doc.
Is it possible to hot redeploy when you run through the main class? I already searched the repository for any possible mention of hot redeploy and couldn't find any. This is probably just an understanding gap on my side.
How to reproduce:
buildscript {
repositories {
mavenCentral()
maven {
name = "Spring snapshot"
url = "http://repo.springsource.org/snapshot"
}
maven {
name = 'Spring milestone'
url = "http://repo.springsource.org/milestone"
}
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:0.5.0.BUILD-SNAPSHOT")
}
}
apply plugin: 'spring-boot'
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'idea'
repositories {
mavenCentral()
maven {
name = "Spring snapshot"
url = "http://repo.springsource.org/snapshot"
}
maven {
name = 'Spring milestone'
url = "http://repo.springsource.org/milestone"
}
}
dependencies {
compile group: 'com.google.guava', name:'guava', version: '14.0.1+'
compile 'org.codehaus.groovy:groovy-all:2.1.6'
compile "org.springframework.boot:spring-boot-starter:0.5.0.BUILD-SNAPSHOT"
compile "org.springframework.boot:spring-boot-starter-jetty:0.5.0.BUILD-SNAPSHOT"
compile "org.springframework.boot:spring-boot-starter-web:0.5.0.BUILD-SNAPSHOT"
}
task createGradleWrapper(type: Wrapper) {
gradleVersion = '1.7'
scriptFile = 'startGradle'
}
springBoot {
mainClass="MainGroovy"
}
@CompileStatic
)org.springframework.boot:spring-boot-starter-jetty:0.5.0.BUILD-SNAPSHOT
)
def static main(String[] args){
SpringApplication.run(MainGroovy, args)
}
I'm sorry if I do something stupid above. Please correct me if I'm wrong.
Thank you.
The recipe needs to install the bash script
Currently, the websockets auto-configuration simply notices the registration of WebSocketHandler
s. This is a good start, but a common (possibly more common) use of WebSockets will be with some messaging on top. It'd be nice if Boot would notice the registration of beans that have been annotated with Spring Messaging annotations (e.g. @SubscribeEvent
, @MessageMapping
) and eliminate the boilerplate configuration.
The boilerplate configuration I'm currently having to embed looks like the following:
@Configuration
@EnableWebSocketMessageBroker
static class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/websocket");
}
@Override
public void configureMessageBroker(MessageBrokerConfigurer configurer) {
configured.setAnnotationMethodDestinationPrefixes("/app");
}
}
As you can see it's simple configuration that would work for most users of Boot (if we were willing to be opinionated on some endpoint names, etc.). I've had a quick chat with @wilkinsona about this, so he and @rstoyanchev might be able to give you a bit more insight into how much automation can be done here.
Would it make sense to add a feature like https://github.com/aharin/inproctester to Spring Boot? I.e. add some support for HtmlUnit, WebDriver or maybe Selenium?
Currently StartupInfoLoggerm only logs information on the Spring Boot and Spring Framework version. Would be nice if the versions of all used Spring portfolio products would be logged (Spring Batch, Spring Data (JPA), Spring Security etc.).
Currently, the embedded Tomcat container (in JAR and CLI modes) stays alive even if the application does not. To reproduce this do the following steps:
git clone https://github.com/cloudfoundry/java-test-applications
cd java-test-applications/spring-boot-application
FAIL_INIT=true spring run web.groovy
You should see an exception generated on the console, the application will not respond on an HTTP port, but the process still lives. This is a problem in a Cloud Foundry environment (but fundamentally any environment where process liveness is monitored) as it appears that the application is fine, but it clearly is not.
A change needs to be made so that the embedded Tomcat container dies when the application dies (which it is designed never to do). In the Java Buildpack we implement this with a giant (horrible) listener. As you're embedding the container, you might be able to do something a bit simpler.
Currently, when an application is starting up, the embedded Tomcat container binds to its port before the application has finished starting. To see this in action, attempt to start a controller that sleeps in a static block. Something like the following:
Controller
class Example {
static {
Thread.sleep(30*1000)
}
@RequestMapping("/")
@ResponseBody
public String controller(HttpEntity<String> requestEntity) {
return "Hello World!"
}
}
When you run spring run app.groovy
, you'll see the console stall before the application has stated completely. However, if you attempt to curl http://localhost:8080
, curl
will also stall because the port is bound and while no response has been returned, a socket connection can be completed. An alternative test is to telnet localhost 8080
and see if a connection can be made.
This is problematic in Cloud Foundry as the HealthManager determines when an application has started by attempted a socket connection to it's provided port. Whether the application is running behind the scenes isn't actually checked, so a false-positive started
can be returned.
The intended behavior should be that when the console is stalled as described above, curl
should return curl: (7) couldn't connect to host
indicating that the port hasn't even been bound to yet. This is typically set in the Tomcat configuration using bindOnInit
. I believe that there is a programmatic equivalent to this configuration parameter.
I have a spring MVC application, which run perfectly fine on my development box but when I give it to my colleage it fails with the below stack trace
Exception in thread "main" java.lang.IllegalStateException: java.lang.NullPointe
rException
at org.springframework.boot.loader.ExecutableArchiveLauncher.<init>(Exec
utableArchiveLauncher.java:47)
at org.springframework.boot.loader.JarLauncher.<init>(JarLauncher.java:2
9)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:42)
Caused by: java.lang.NullPointerException
at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.ge
tPosition(RandomAccessDataJarInputStream.java:79)
at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.ge
tNextEntry(RandomAccessDataJarInputStream.java:70)
at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.ge
tNextEntry(RandomAccessDataJarInputStream.java:35)
at java.util.jar.JarInputStream.getNextJarEntry(Unknown Source)
at java.util.jar.JarInputStream.<init>(Unknown Source)
at java.util.jar.JarInputStream.<init>(Unknown Source)
at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.<i
nit>(RandomAccessDataJarInputStream.java:59)
at org.springframework.boot.loader.jar.RandomAccessDataJarInputStream.<i
nit>(RandomAccessDataJarInputStream.java:47)
at org.springframework.boot.loader.jar.RandomAccessJarFile.<init>(Random
AccessJarFile.java:120)
at org.springframework.boot.loader.jar.RandomAccessJarFile.<init>(Random
AccessJarFile.java:100)
at org.springframework.boot.loader.jar.RandomAccessJarFile.<init>(Random
AccessJarFile.java:89)
at org.springframework.boot.loader.archive.JarFileArchive.<init>(JarFile
Archive.java:46)
at org.springframework.boot.loader.ExecutableArchiveLauncher.createArchi
ve(ExecutableArchiveLauncher.java:64)
at org.springframework.boot.loader.ExecutableArchiveLauncher.<init>(Exec
utableArchiveLauncher.java:44)
... 2 more
Any Idea ?
In the documentation for Spring Boot - Actuator, the code sample shown for returning a Map<String,String> doesn't work in either Groovy script nor Java app. The app compiles fine, but when accessed from the browser or curl. Actuator doc located here: https://github.com/SpringSource/spring-boot/blob/master/spring-boot-actuator/README.md.
Embedded jetty server response:
<title>Error 406 Not Acceptable</title>Problem accessing /. Reason:
Not Acceptable
Not sure if its already supported but I need the ability to configure Mutual SSL Authentication in Jetty/Tomcat.
See comment in 519d81c#commitcomment-4304068
I know that the PropertySourcesPlaceholderConfigurer supports this, but not so sure how to integrate it a spring-boot app.
It would be great to have better tests support. So far it seems the only way to do tests is to run an embedded server. I would like
When overriding the default versions included in Spring Boot for JPA integration, an exception is encountered because of the addition of an Environment
to the Spring Data AnnotationRepositoryConfigurationSource
CTOR. To fix this, we need to make AbstractRepositoryConfigurationSourceSupport
EnvironmentAware
and pass that to AnnotationRepositoryConfigurationSource's CTOR.
This is a breaking change with earlier versions of Spring Data.
Would you please those conditions in the DataSourceAutoConfiguration, and indeed all Conditions in Spring Boot, public please? I think a lot of them would be useful as basis for other conditions developers might want to write, and they compose well since u have convenience methods like matchesAny().
Platform encoding issues cause headaches to no end, both in development and production. As a part of adopting sensible defaults, Spring Boot can help this issue.
Spring Boot provides, through intermediaries, functionalities such as SQL schema loading or URL handling, which are sensitive to default encoding settings, and may apparently randomly produce unexpected results for some users and developers.
Spring Boot should, by default, fail to start with an informative error message, if the JVM encoding settings aren't UTF-8. The user should be able to convert the error+exit to a warning with a command line parameter.
Iñtërnâtiônàlizætiøn!
I'm attempting to map the value of the environment variable GITHUB_CLIENT_ID
onto an @ConfigurationProperties
class as defined below:
@ConfigurationProperties(name = "github", ignoreUnknownFields = false)
public final class GitHubProperties {
private volatile Client client = new Client();
public Client getClient() { return this.client; }
public void setClient(Client client) { this.client = client; }
public static class Client {
private volatile String id = "";
private volatile String secret = "";
public String getId() { return this.id; }
public void setId(String id) { this.id = id; }
public String getSecret() { return this.secret; }
public void setSecret(String secret) { this.secret = secret; }
}
}
Currently, the value of the environment variable is not bound correctly. However, if I set the property in application.yml
it does.
---
github:
client:
id: dummy-id
The weird thing is that the value that is bound is the value from the environment not from the application.yml
file. I believe I've traced the bug to the RelaxedDataBinder.getProperyValuesForNamePrefix()
method. The method attempts to find the candidate keys for bind, but does so by scanning for methods staring with <name>.
. In my case it's looking for github.
which doesn't exist until I create that key in the application.yml
.
Once it's found the candidate key though, it seems to do the "relaxed" binding just fine.
I believe that a change needs to be made to use the "relaxed" key matching algorithm when searching for the candidate keys.
Hi -
I am trying to define and error page to handle 404, 500, and what not in a spring boot application. Following the sample on https://github.com/spring-projects/spring-boot/blob/master/spring-boot/README.md#customizing-servlet-containers, I see define a servletContainer bean, which SHOULD in theory take precedence over that defined through @EnableAutoConfiguration.
When I debug the application, that is not what is happening. The auto configured servletContainer bean is stepping over my defined one and thus the default settings. i.e. the break point set in AbstractEmbeddedServletContainerFactory is hit twice. Once for my configured bean, and then once by the default auto configured bean.
My application is here https://github.com/berinle/spring-boot-sample
I'd appreciate if you can point me in the right direction.
Thanks.
NB: Also, on another note, specifying "server.port" in application.properties gets respected, but doing the same in my custom servletContainer is not. What am I doing wrong?
Add default suffix and prefix.
Hello,
[ERROR] The project com.self.SB:SpringBootTest:0.0.1-SNAPSHOT (D:\GitProjects\SpringBootTest\pom.xml) has 1 error
Apache Maven 3.1.0 (893ca28a1da9d5f51ac03827af98bb730128f9f2; 2013-06-28 04:15:32+0200)
Maven home: D:\Tools\maven310\bin..
Java version: 1.7.0_40, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_40\jre
Default locale: en_IN, platform encoding: Cp1252
My project is still blank jee web app. I have not created any Java file yet.
But after changing the pom.xml file only it is throwing exception.
Currently the homebrew install script points at 0.5.0.M1
. This change updates it to 0.5.0.M4
.
This is probably a understanding gap on my side - I couldn't figure out a way of moving from a standalone embedded version of an application(executed using SpringApplication) to a war version of the application which is expected to be deployed in an external container. Specifically some of the auto-configuration parts seem to stop working - for eg, in my case the hsqldb autocreate of the tables did not work in a deployed mode. Is there a documentation on how to go about doing this?
I do not want boot to handle the / mapping for me. I want it to be handled by the tomcat one. But it seems that boots always handles this. What I used to do with the classic web.xml is define one mapping:
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
now I do not see a way to achieve that looking at EmbeddedWebApplicationContext class in the getServletContextInitializerBeans method
Hi I'm using the Stormpath Java SDK as dependency in my spring-boot project and building the entire thing as a fat jar using the spring-boot gradle plugin, and it throws an exception trying get its manifest file.
java.lang.RuntimeException: Unable to obtain version from manifest path [jar:file:/Users/jarias/Code/jarias/tk/build/libs/tk-0.1.0.jar!/lib/stormpath-sdk-impl-0.8.1.jar!/META-INF/MANIFEST.MF]
at com.stormpath.sdk.impl.http.support.Version.getManifest(Version.java:56)
at com.stormpath.sdk.impl.http.support.Version.lookupClientVersion(Version.java:43)
at com.stormpath.sdk.impl.http.support.Version.<clinit>(Version.java:28)
at com.stormpath.sdk.impl.ds.DefaultDataStore.applyDefaultRequestHeaders(DefaultDataStore.java:593)
The code from Version.java looks like this:
private static String lookupClientVersion() {
Class clazz = Version.class;
String className = clazz.getSimpleName() + ".class";
String classPath = clazz.getResource(className).toString();
if (!classPath.startsWith("jar")) {
// Class not from JAR
return "NOT-FROM-JAR";
}
String manifestPath = classPath.substring(0, classPath.lastIndexOf("!") + 1) + "/META-INF/MANIFEST.MF";
Manifest manifest = getManifest(manifestPath);
Attributes attr = manifest.getMainAttributes();
String value = attr.getValue("Implementation-Version");
if (value == null) {
throw new IllegalStateException("Unable to obtain 'Implementation-Version' property from manifest.");
}
return value;
}
private static Manifest getManifest(String path) {
try {
return new Manifest(new URL(path).openStream());
} catch (IOException e) {
throw new RuntimeException("Unable to obtain version from manifest path [" + path + "]");
}
}
Is this something that can be done using the fat jar? What should code look like? And can it maintain compatibility when this lib is use in a non spring-boot fat jar?
If a fix is possible I'll pass it along to the Stormpath team.
By the way I got a similar issue with JBoss TS but it wasn't getting the manifest but a properties file thats inside the JBoss TS jar(s) my workaround in that case was to dup the prop file in my project.
Hi -
I am trying to use thymeleaf as the template engine for spring boot. I have followed this guide (http://www.thymeleaf.org/springmail.html) and the issue I am running into is that thymeleaf can't seem to resolve the variables set in org.thymeleaf.context.Context when I make the call to process the template.
I get errors like this...
org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "user" (email.html:7)
at org.thymeleaf.spring3.expression.SpelVariableExpressionEvaluator.evaluate(SpelVariableExpressionEvaluator.java:108)
at org.thymeleaf.standard.expression.VariableExpression.executeVariable(VariableExpression.java:116)
at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:394)
....
I have the sample application here https://github.com/berinle/spring-boot-sample
It can be run by cloning the project and "cd" into it and run the following command: "./gradlew run" (without the quotes). Then open your browser and hit http://localhost:8080.
Click the "send email" button and you should see the error on the console.
Also a broader question is what is the best way to easily override the generated "templateEngine" bean created by @EnableAutoConfiguration?
On the "dev" branch of the same project above, I have configured the following beans...
@Bean
public ServletContextTemplateResolver webTemplateResolver() {
ServletContextTemplateResolver templateResolver = new ServletContextTemplateResolver();
templateResolver.setPrefix("templates/");
templateResolver.setTemplateMode("HTML5");
templateResolver.setSuffix(".html");
templateResolver.setOrder(2);
templateResolver.setCacheable(true);
return templateResolver;
}
@Bean
public SpringTemplateEngine templateEngine(){
SpringTemplateEngine templateEngine = new SpringTemplateEngine();
templateEngine.addTemplateResolver(emailTemplateResolver());
templateEngine.addTemplateResolver(webTemplateResolver());
return templateEngine;
}
@Bean
public ThymeleafViewResolver thymeleafViewResolver(){
ThymeleafViewResolver resolver = new ThymeleafViewResolver();
resolver.setTemplateEngine(templateEngine());
resolver.setCharacterEncoding("UTF-8");
resolver.setOrder(Ordered.LOWEST_PRECEDENCE - 20);
return resolver;
}
But navigating to http://localhost:8080 after that configuration reports the following error...
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: Error resolving template "index", template might not exist or might not be accessible by any of the configured Template Resolvers
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:958)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:837)
....
In a fresh clone, mvn clean install
leads to failures in the spring-boot module:
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[22,34] package org.apache.commons.logging does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[23,34] package org.apache.commons.logging does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[24,33] package org.springframework.beans does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[25,33] package org.springframework.beans does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[26,33] package org.springframework.beans does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[27,41] package org.springframework.beans.factory does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[28,41] package org.springframework.beans.factory does not exist
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[47,59] cannot find symbol
symbol: class FactoryBean
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[47,8] cannot access org.springframework.beans.factory.Aware
class file for org.springframework.beans.factory.Aware not found
[ERROR] /home/rossen/dev/sources/github/springsource/spring-boot/spring-boot/src/main/java/org/springframework/boot/bind/PropertiesConfigurationFactory.java:[50,23] cannot find symbol
symbol: class Log
location: class org.springframework.boot.bind.PropertiesConfigurationFactory<T>
D:\my-app\spring-boot>mvn package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myproject 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ myproject
---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. b
uild is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\my-app\spring-boot\src\main\resour
ces
[INFO] skip non existing resourceDirectory D:\my-app\spring-boot\src\main\resour
ces
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ myproject ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ my
project ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources,
i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\my-app\spring-boot\src\test\resour
ces
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ myproje
ct ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.15:test (default-test) @ myproject ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ myproject ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO]
[INFO] --- spring-boot-maven-plugin:0.5.0.M1:repackage (default) @ myproject ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.510s
[INFO] Finished at: Wed Aug 07 13:57:13 PDT 2013
[INFO] Final Memory: 9M/107M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin
:0.5.0.M1:repackage (default) on project myproject: error in opening zip file ->
[Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
D:\my-app\spring-boot>
Hi -
While I am able to mostly configure SSL for an embedded tomcat instance, when trying to read the SSL port from system properties, it is failing.
According to Dave, this should be working (https://twitter.com/david_syer/status/396767205725339648).
I put up a quick sample to illustrate this behavior. Please advice.
https://github.com/berinle/spring-boot-sample/tree/security
Thanks
PS: its on the "security" branch of the project, not master.
Add support for Spring Boot to detect spring-jms on the path, and subsequent support for spring-boot-cli as well.
We should generate and publish a homebrew script to make it easy to push upstream
Currently the Banner implementation uses a Printstream to write the log, it would be nice if the Banner would be printen (also) using a Log. That way it would appear in logfiles also, making it quite clear when an application started.
I ran into a small issue with spring-boot when migrating existing project to it recently: the SampleApplication.run(sources, args) doesn't recognize the wild cards and properties inside of the source string (like "classpath:*-context.xml" is not getting recognized whereas "classpath:my-context.xml" does). The reason is the BeanDefinitionLoader which doesn't check for and use the ResourcePatternResolver.getResources() like AbstractBeanDefinitionReader.loadBeanDefinitions() does, for instance.
When incrementing values increments may be lost as the steps to retrieve a metric, increment it, and store it again are not performed atomically. The following test will fail:
@Test
public void concurrentIncrements() throws InterruptedException {
ExecutorService executor = Executors.newFixedThreadPool(25);
final String metricName = "test";
final CountDownLatch latch = new CountDownLatch(1000);
for (int i = 0; i < 1000; i++) {
executor.execute(new Runnable() {
@Override
public void run() {
metricRepository.increment(metricName, 1, new Date());
latch.countDown();
}
});
}
latch.await();
assertEquals(1000, (int)metricRepository.findOne(metricName).getValue());
}
Concurrent finds and deletes may fail with an NPE:
Due to this problem, the following test will fail:
@Test
public void concurrentFindAndDelete() throws InterruptedException {
ExecutorService executor = Executors.newFixedThreadPool(25);
final String metricName = "test";
final CountDownLatch latch = new CountDownLatch(1000);
final AtomicInteger errors = new AtomicInteger();
for (int i = 0; i < 1000; i++) {
executor.execute(new Runnable() {
@Override
public void run() {
try {
metricRepository.set(metricName, 10, new Date());
metricRepository.findOne(metricName);
metricRepository.delete(metricName);
} catch (Exception e) {
errors.incrementAndGet();
} finally {
latch.countDown();
}
}
});
}
latch.await();
assertEquals(0, errors.incrementAndGet());
}
There's also a problem with the use of replace in increment and set when delete's called at the same time – replace may have no effect due to the following sequence of events:
When editing Thymeleaf templates, a server restart is required to view the updates.
Even with the following setting in application.properties
:
# Allow Thymeleaf templates to be reloaded at dev time
spring.template.cache: false
To reproduce:
With spring-boot-sample-web-ui
, run it with mvn spring-boot:run
and edit any of the templates, they don't reload after server has been started.
The other http://spring.io guides provide a working example of how to obtain the source code examples. For instance, it says at http://spring.io/guides/gs/authenticating-ldap/
the following:
Download and unzip the source repository for this guide, or clone it using Git: git clone https://github.com/spring-guides/gs-authenticating-ldap.git
By contrast, however, I found it impossible to use "git clone" to obtain spring-boot source code examples. Below are some of my failed attempts. I finally realized the only way to get the "boot" code was to fork and then do a git clone from my own 29meg fork. You really did not mean to require that, did you? It means nobody can use boot examples unless they have a GitHub account and fork the entire boot repo. None of the other spring.io guides have that requirement. (See failed attempts to "git clone" below)
C:\rdg_dev\Spring\spring.io\tuts>git clone https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-simple
Cloning into 'spring-boot-sample-simple'...
fatal: repository 'https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-simple/' not found
C:\rdg_dev\Spring\spring.io\tuts>git clone https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples
Cloning into 'spring-boot-samples'...
fatal: repository 'https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/' not found
Hi,
When trying to download the binary distribution http://repo.springframework.org/milestone/org/springframework/boot/spring-boot-cli/0.5.0.M1/spring-boot-cli-0.5.0.M1-bin.tar.gz redirects to http://www.jfrog.com/
Is it a temporary issue or there's some location on jfrog.com the spring-boot-cli could be downloaded from?
Thanks,
Radu
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.