Skip to content
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

When specified the Non-existent package using @ControllerAdvice(basePackages), has been applied to all controllers. [SPR-12510] #17115

Closed
spring-projects-issues opened this issue Dec 5, 2014 · 4 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches status: duplicate A duplicate of another issue
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Dec 5, 2014

Kazuki Shimizu opened SPR-12510 and commented

e.g)

package io.github.kazuki43zoo.app;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ModelAttribute;


@ControllerAdvice(basePackages = "xxxx")
public class AppControllerAdvice {

    @ModelAttribute("appCommonMessage")
    public String commonMessage() {
        System.out.println("AppControllerAdvice#appCommonMessage() called.");
        return "Hello in AppControllerAdvice.";
    }

}

Above @ModelAttribute method has been applied to the all controllers.( e.g: controllers under io.github.kazuki43zoo.app package).

I think feel unnatural in this behavior.
This behavior is specification ?

As related information ..
When specified the Non-existent package using @ComponentScan(basePackages), controller is not scanned.

I think should be changed to the same behavior with @CompnentScan.

How do think ?


Affects: 4.0.8, 4.1.2

Issue Links:

Backported to: 4.0.9

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 5, 2014

Juergen Hoeller commented

This one has been fixed in the latest 4.1.3 snapshot already and is also scheduled for a backport to 4.0.9. See my comment on #17111 for details.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Kazuki Shimizu commented

Hi Juergen,

Thank you for answer.
I confirmed that it has been resolved in 4.1.3.BUILD-SNAPSHOT :)

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Dec 5, 2014

Juergen Hoeller commented

Good to hear!

As for #17114, we will probably only fix this in the 4.1.x line - but also in time for 4.1.3 early next week.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Kazuki Shimizu commented

we will probably only fix this in the 4.1.x line

No problem !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants