-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Spring Security configuration options are picked up too early #400
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think it's possible for security properties to be parsed in a different order, so I suspect pilot error. Are you sure that the local properties are being read? Are you sure that you haven't got a spelling error, or whitespace problem or something in the local file? |
Nope, i just checked it with my app. I've fixed the errors you had (michael-simons/biking2@a2b9a2b) so you can try it out yourself: mvn clean && mvn -DskipTests=true package
mkdir f
mv target/biking2-0.2.6-SNAPSHOT.jar f/
cd f
echo "security.user.name = foo" >> application.properties
echo "security.user.password = bar" >> application.properties
java -jar biking2-0.2.6-SNAPSHOT.jar
// i expect Spring Boot to pike up the application.properties parallel to the jar
curl -ufoo:bar -X POST -H "Content-Type: application/json" -d '{"name":"test", "boughtOn":"2014-02-26T10:24:41.083Z", "color":"ccc"}' http://localhost:8080/api/bikes
// but i get a 401
// using the default it works
curl -ubiking2:biking2 -X POST -H "Content-Type: application/json" -d '{"name":"test", "boughtOn":"2014-02-26T10:24:41.083Z", "color":"ccc"}' http://localhost:8080/api/bikes When i change the start to include the explicit path java -Dspring.config.location=./application.properties -jar biking2-0.2.6-SNAPSHOT.jar it works as expected. Note: All properties from the file in parallel to the jar ARE picked up, wether i use the java parameter or not. |
It works for me with your "public" branch and a SNAPSHOT of Boot. Can you verify and we can call this fixed? |
I made a fresh mvn clean && mvn package on master of spring-boot, used it with my app and now it works as expected. Great. I am / was using RC3 before. |
OK. We did tweak the config parsing a bit, so I'll assume it was that, but can't put my finger on the relevant change. |
Just to let you know, works fine with 1.0.0.RC4, thanks! |
Have a look at this application:
https://github.com/michael-simons/biking2
I'll use it as a deployed executable jar file.
It contains an application.properties inside the deployed jar file at classpath:application.properties with 2 defaults:
security.user.name = biking2
security.user.password = biking2
these are picked up correct.
In production I have another application.properties parallel to the jar
./biking2.jar
./application.properties
when i run java -jar biking2.jar, properties from those 2nd file are picked up but not the security.* properties, those are still the properties from the jar file.
The text was updated successfully, but these errors were encountered: