-
Notifications
You must be signed in to change notification settings - Fork 40.8k
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
Code sample in "Developing Your First Spring Boot Application" does not work #34513
Comments
In which package is your main application located? The error message seems to indicate that it is using an invalid location. Can you share a sample application showing the problem? |
No package. File is located as stated in documentation at src/main/java/MyApplication.java Application sample is copy-paste from documentation file MyApplication.java |
I suggest to change file location to src/main/java/example/MyApplication.java and add "package example;" at the top of example file |
Has this been picked up by anyone ? If not i can pick this up |
Thanks for the offer, @petrovskimario. It's all yours. The code already has a package but it's deliberately removed by the code chomping in our Asciidoctor backend. It should be possible to use |
Hello @wilkinsona Also one more thing Why is it looking for a docker compose file ? |
You can set a document-wide attribute in
But this will affect every code snippet in the documentation. I thought it should also be possible to set it on a per-snippet basis like this:
But it doesn't seem to work. Should it have worked, @philwebb? With the global attribute in place, the package always appears, even when the snippet isn't expanded: package example;
@RestController
@SpringBootApplication
public class MyApplication {
@RequestMapping("/")
String home() {
return "Hello World!";
}
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
} I'm not sure if this is what we want. It might be nice for the package to be changed but remain hidden until the code's expanded or copied. |
I'll have to take a look at the backend code. We do have this test but it's not using |
Is it maybe possible to use the chomp_package_replacement with some predicates ? |
@petrovskimario do you still need help for this? Any update for us? |
@snicoll as per Phil's comment there's a limitation of the Asciidoctor backend that's blocking progress. |
It turns out the the backend does support but the attribute needs to be above the include line and not part of it. |
MyApplication.java example code do not work without package declaration. spring-boot:run command shows
The text was updated successfully, but these errors were encountered: