Coder Social home page Coder Social logo
spring-boot

spring-projects / spring-boot Goto Github PK

View Code? Open in Web Editor NEW
62.6K 3.4K 34.9K 150.81 MB

Spring Boot

Home Page: https://spring.io/projects/spring-boot

License: Apache License 2.0

Java 97.22% Smarty 0.01% HTML 0.26% Groovy 0.13% Shell 0.20% Ruby 0.04% CSS 0.01% JavaScript 0.15% Batchfile 0.01% Kotlin 1.96% Dockerfile 0.01% Vim Snippet 0.01% Mustache 0.01%
java spring-boot spring framework

spring-boot's Introduction

Spring Boot Build Status Chat Revved up by Gradle Enterprise

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss. It takes an opinionated view of the Spring platform so that new and existing users can quickly get to the bits they need.

You can use Spring Boot to create stand-alone Java applications that can be started using java -jar or more traditional WAR deployments. We also provide a command-line tool that runs Spring scripts.

Our primary goals are:

  • Provide a radically faster and widely accessible getting started experience for all Spring development.

  • Be opinionated, but get out of the way quickly as requirements start to diverge from the defaults.

  • Provide a range of non-functional features common to large classes of projects (for example, embedded servers, security, metrics, health checks, externalized configuration).

  • Absolutely no code generation and no requirement for XML configuration.

Installation and Getting Started

The reference documentation includes detailed installation instructions as well as a comprehensive getting started guide.

Here is a quick teaser of a complete Spring Boot application in Java:

import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.web.bind.annotation.*;

@RestController
@SpringBootApplication
public class Example {

	@RequestMapping("/")
	String home() {
		return "Hello World!";
	}

	public static void main(String[] args) {
		SpringApplication.run(Example.class, args);
	}

}

Getting Help

Are you having trouble with Spring Boot? We want to help!

Reporting Issues

Spring Boot uses GitHub’s integrated issue tracking system to record bugs and feature requests. If you want to raise an issue, please follow the recommendations below:

  • Before you log a bug, please search the issue tracker to see if someone has already reported the problem.

  • If the issue doesn’t already exist, create a new issue.

  • Please provide as much information as possible with the issue report. We like to know the Spring Boot version, operating system, and JVM version you’re using.

  • If you need to paste code or include a stack trace, use Markdown. ``` escapes before and after your text.

  • If possible, try to create a test case or project that replicates the problem and attach it to the issue.

Building from Source

You don’t need to build from source to use Spring Boot (binaries in repo.spring.io), but if you want to try out the latest and greatest, Spring Boot can be built and published to your local Maven cache using the Gradle wrapper. You also need JDK 17.

$ ./gradlew publishToMavenLocal

This will build all of the jars and documentation and publish them to your local Maven cache. It won’t run any of the tests. If you want to build everything, use the build task:

$ ./gradlew build

Modules

There are several modules in Spring Boot. Here is a quick overview:

spring-boot

The main library providing features that support the other parts of Spring Boot. These include:

  • The SpringApplication class, providing static convenience methods that can be used to write a stand-alone Spring Application. Its sole job is to create and refresh an appropriate Spring ApplicationContext.

  • Embedded web applications with a choice of container (Tomcat, Jetty, or Undertow).

  • First-class externalized configuration support.

  • Convenience ApplicationContext initializers, including support for sensible logging defaults.

spring-boot-autoconfigure

Spring Boot can configure large parts of typical applications based on the content of their classpath. A single @EnableAutoConfiguration annotation triggers auto-configuration of the Spring context.

Auto-configuration attempts to deduce which beans a user might need. For example, if HSQLDB is on the classpath, and the user has not configured any database connections, then they probably want an in-memory database to be defined. Auto-configuration will always back away as the user starts to define their own beans.

spring-boot-starters

Starters are a set of convenient dependency descriptors that you can include in your application. You get a one-stop shop for all the Spring and related technology you need without having to hunt through sample code and copy-paste loads of dependency descriptors. For example, if you want to get started using Spring and JPA for database access, include the spring-boot-starter-data-jpa dependency in your project, and you are good to go.

spring-boot-cli

The Spring command-line application compiles and runs Groovy source, allowing you to write the absolute minimum amount of code to get an application running. Spring CLI can also watch files, automatically recompiling and restarting when they change.

spring-boot-actuator

Actuator endpoints let you monitor and interact with your application. Spring Boot Actuator provides the infrastructure required for actuator endpoints. It contains annotation support for actuator endpoints. This module provides many endpoints, including the HealthEndpoint, EnvironmentEndpoint, BeansEndpoint, and many more.

spring-boot-actuator-autoconfigure

This provides auto-configuration for actuator endpoints based on the content of the classpath and a set of properties. For instance, if Micrometer is on the classpath, it will auto-configure the MetricsEndpoint. It contains configuration to expose endpoints over HTTP or JMX. Just like Spring Boot AutoConfigure, this will back away as the user starts to define their own beans.

spring-boot-test

This module contains core items and annotations that can be helpful when testing your application.

spring-boot-test-autoconfigure

Like other Spring Boot auto-configuration modules, spring-boot-test-autoconfigure provides auto-configuration for tests based on the classpath. It includes many annotations that can automatically configure a slice of your application that needs to be tested.

spring-boot-loader

Spring Boot Loader provides the secret sauce that allows you to build a single jar file that can be launched using java -jar. Generally, you will not need to use spring-boot-loader directly but work with the Gradle or Maven plugin instead.

spring-boot-devtools

The spring-boot-devtools module provides additional development-time features, such as automatic restarts, for a smoother application development experience. Developer tools are automatically disabled when running a fully packaged application.

Samples

Groovy samples for use with the command line application are available in spring-boot-cli/samples. To run the CLI samples, type spring run <sample>.groovy from the samples directory.

Guides

The spring.io site contains several guides that show how to use Spring Boot step-by-step:

License

Spring Boot is Open Source software released under the Apache 2.0 license.

spring-boot's People

Contributors

snicoll avatar wilkinsona avatar philwebb avatar mbhave avatar dsyer avatar izeye avatar bclozel avatar dreis2211 avatar scottfrederick avatar spring-builds avatar mhalbritter avatar vpavic avatar eddumelendez avatar cdupuis avatar nosan avatar garyrussell avatar sdeleuze avatar igor-suhorukov avatar ayudovin avatar Buzzardo avatar artembilan avatar kazuki43zoo avatar michael-simons avatar rwinch avatar gregturn avatar odrotbohm avatar polarbear567 avatar onobc avatar htynkn avatar spring-operator avatar

Stargazers

 avatar  avatar Spa_ce42 avatar Yun Feng avatar  avatar  avatar Kevin Bell avatar Jahoo avatar 吟一曲苍穹 avatar Yaoxing Shan avatar  avatar WonJoon Choi avatar 花鸟风月 avatar Patrick avatar Marcus Cvjeticanin avatar Finn Yu avatar Bahmed Benyammi avatar feng avatar Bill avatar  avatar Naveen Kumar avatar Park Su-Han avatar  avatar kevinfu2048 avatar  avatar  avatar  avatar yszzz avatar Tonino Catapano avatar Ridineu de Moraes Neto avatar Partur avatar TzuYao avatar  avatar smoonthsky avatar 海上云烟 avatar 陈志昊 avatar  avatar Youssef Wadie avatar  avatar  avatar Paulo avatar Gokul Alok Vardhan Sanjay Chintala avatar nopnoping avatar  avatar ArdenL_Liu avatar tt black avatar fool avatar  avatar Peyman avatar Amirsam Bahador avatar ipaler avatar Klee avatar  avatar Chaolong avatar Abhinav Gauniyal avatar wqddg avatar  avatar  avatar  avatar  avatar Nguyen avatar seok-hyeon Kang avatar sissilab avatar  avatar  avatar Gaurav Sharma avatar ImhoDev avatar Eduardo Aben Athar avatar  avatar SH avatar  avatar Gerald Chen avatar  avatar Jon avatar LiChengBo_ avatar FrankQiu avatar Marlene Moraes avatar Jocilé Serra avatar Raphael Cunha Fontoura avatar Yukio Mizuta avatar Fabian Krüger avatar Jiang Guozhu avatar ykc avatar  avatar  avatar Shubham Jain avatar  avatar  avatar  avatar alexxriv avatar  avatar RamaRaoGV avatar Jaejeong Sohn avatar Jacky Yu avatar  avatar Nicolas Carry avatar WSHua avatar Lius avatar mijac avatar Rob Wright avatar

Watchers

Dario Alves Junior avatar arden avatar Al Sargent avatar Shin Jan Wu avatar Alex Lee avatar  avatar A Vaz avatar André Faria Gomes avatar  avatar  avatar Jiang avatar edwardt avatar syco avatar mlzboy avatar Libing Chen avatar Ryan Morgan avatar  avatar 唐古拉山 avatar Josh Long avatar  avatar Imran Ansari avatar jonny avatar Scott Frederick avatar Panayiotis Tzagkarakis avatar Tomokazu Imai avatar Sysmat avatar Eko Kurniawan Khannedy avatar Joris Kuipers avatar Eric avatar Jawf avatar  avatar  avatar Will Droste avatar Michael Yan avatar 简单框架(马克) avatar sharper avatar Brian Matthews avatar Brian Clozel avatar ROHITHA DASSANAYAKE avatar hbombonato avatar geminilu avatar Ubao Daddy avatar Marcello DeSales avatar Hilton Gonçalves avatar Andy avatar Andre Venter avatar 鱼中鱼 avatar Juan Antonio Breña Moral avatar Tufan Görel avatar Jacey New avatar Michael Legart avatar Fernando avatar  avatar Filip Procházka avatar Reggie Zhang avatar  avatar Craig Walls avatar  avatar pipin avatar Russel Arthur avatar  avatar Rodrigo A. R. de Almeida avatar Rakhmad Azhari avatar Andreas Ahlenstorf avatar Phu Ha avatar Khatanbaatar avatar Alberto Flores avatar Matthias Deck avatar Vitaliy avatar Jhonghee Park avatar Alberich avatar Alsan Wong avatar ilker avatar cntoby avatar Richard Lee avatar  avatar Lucas Nascimento avatar Ian Mulchey avatar  avatar allan song avatar sillypeng avatar Dang Dinh Thanh avatar Wang Shuai avatar showbt avatar Antouan Anguelov avatar Jandy avatar hbdrawn avatar joony avatar cnmade avatar Holger Stolzenberg avatar Konrad@SDC:WOB avatar  avatar  avatar  avatar bxvs888 avatar  avatar  avatar Thomas Darimont avatar baihua.huang avatar Bahman Movaqar avatar

spring-boot's Issues

spring.database.username defaults to sa at all times

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.

Active profile specified in application.properties or --spring.active.profiles is not being used.

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

By default, app startup should fail if file.encoding and sun.jnu.encoding != UTF-8

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!

SSL on embedded tomcat not picking up env properties via @Value

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.

Thymeleaf templates cache even when spring.template.cache: false

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.

Getting the MANIFEST.MF from a dependency in the fat jar

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.

Gradle plugin fails on Java 8

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


Setting error pages & overriding default configured beans

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?

Enhance WebSockets auto-configuration to notice messaging

Currently, the websockets auto-configuration simply notices the registration of WebSocketHandlers. 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.

Adding spring-security 3.2.0.RC1 dependency to the project prevents application from starting

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

Switch banner to use a Log

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.

Adding a DispatcherServlet bean does not always override the default

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

Hot Redeploy and Command Line Running from Gradle

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:

  • The project is initially constructed using the following Gradle build. I use this mainly just to generate IDEA project, so I think there's no effect here.

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"
}

  • The main class and controller is coded in static Groovy (@CompileStatic)
  • I use embedded jetty (org.springframework.boot:spring-boot-starter-jetty:0.5.0.BUILD-SNAPSHOT)
  • Run main class directly from IDE (Intellij) without generating any jar file. Main class contains:

 def static main(String[] args){
        SpringApplication.run(MainGroovy, args)
 }

  • Run the main class above (c-shift-f10). Open browser and test the URL, everything is working.
  • Modify some of your Controller class then compile (c-shift-f9).
  • refresh browser, nothing change, have to re-run the main class then only changes appear.

I'm sorry if I do something stupid above. Please correct me if I'm wrong.

Thank you.

ResponseBody of Map<String,String> in Actuator Not Working

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>

HTTP ERROR 406

Problem accessing /. Reason:

    Not Acceptable


Powered by Jetty://



















Support for repository testing and maybe convenience annotations for integration testing

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

  • Support for an annotation like ContextConfiguration but using a Spring Boot application class instead. It would fire up the ApplicationContext - but not the web part. That way services and repositories could be tested without a container.
  • An probably also support for the Spring Web MVC testing support instead of in-container testing.

Spring Boot Jar run fails

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 ?

Add better detection for Rabbit vs. JMS

Right now, CLI detection of Rabbit vs. JMS requires a special annotation for each, due to name collisions of SimpleMessageLIstenerContainer.

  • If we see RabbitTemplate for a producer, we can flag it as Spring Rabbit.
  • If we see DefaultMessageListenerContainer, it's Spring JMS.
  • If we see SimpleMessageListenerContainer and it has a method starting with "setDestination*", it's also Spring JMS.
  • If it's SimpleMessageListenerContainer and it has a "setQueue*" method name, it's Spring Rabbit.
    These last two clues will require another AstUtils utility method designed to peek at method names for a given class node so we can deduce whether it's Spring JMS or Spring Rabbit.

With those changes, we can deprecate the @EnableRabbitMessaging and @EnableJmsMessaging annotations and eventually remove them.

Properties and wildcards are not recognized in the SpringApplication.run() sources

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.

AbstractRepositoryConfigurationSourceSupport needs updated to work with latest Spring Data JPA

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.

BeanDefinitionLoader cannot load resources when LaunchedURLClassLoader is the current classloader

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.

RelaxedDataBinder does not bind values that are only defined in environment variable style

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.

screen shot 2013-10-26 at 10 39 04

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.

unable to get clone spring-boot

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

Embedded Tomcat container binds port before application is completely started

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.

StartupInfoLogger should log version of more Spring project

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.).

Embedded Tomcat container stays alive even if the application does not

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.

Documentation: Moving from an embedded to a deployment version of the application

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?

Error encountered while using thymeleaf as email templating

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)

....

mvn package have a error. please help me

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>

InMemoryMetricRepository isn't thread-safe

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:

  1. Thread one calls containsKey to check for the existence of the metric
  2. Thread two removes the metric
  3. Thread one assumes the metric's still there and calls this.metrics.get(metricName).getMetric(), resulting in 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:

  1. Thread 1 calls containsKey to check that the metric's there
  2. Thead 2 deletes the metric
  3. Thread 1 calls replace which has no effect

Fresh `mvn clean install` failures

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>

SpringBoot application , throws error while mvn package

Hello,

this is the error -

[ERROR] The project com.self.SB:SpringBootTest:0.0.1-SNAPSHOT (D:\GitProjects\SpringBootTest\pom.xml) has 1 error

[ERROR] 'dependencies.dependency.version' for org.sprintframework.boot:spring-boot-starter-web:jar is missing. @ line 39, column 16

I use this configuration

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

OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

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.

spring run --local does not accumulate dependencies in a local directory

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.

Make Spring Boot compatible with GVM

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.