Comments (4)
Thanks for the sample. It allowed me to determine that this is a duplicate of #33415. You can work around it by importing AOP auto-configuration:
@Import(SecurityConfig.class)
@WebMvcTest(value = HelloController.class)
@ImportAutoConfiguration(AopAutoConfiguration.class)
class HelloControllerTest {
from spring-boot.
Thanks for the report, but it's not clear to me why you have opened a Spring Boot issue. Spring Boot isn't involved with the discovery of the @PreAuthorize
annotations. It's Spring Security that does that. Perhaps you're saying that the problem only occurs with @WebMvcTest
and doesn't occur when running the application's main method or perhaps when using @SpringBootTest
? If that's the case and you would like us to investigate, please provide a complete yet minimal sample that demonstrates these differences in behaviour. If that's not the case, this should probably be a Spring Security issue as it sounds like it's out of Spring Boot's control.
from spring-boot.
Yes that is the case it is linked to @WebMvcTest I believe.
Everything works fine otherwise, the app itself is fine.
Here is the test repo : https://github.com/alexisgayte/spring-framework-30489/tree/main
I personally moved the interface into the controller that resolved my issue.
But that looks a bug. May be Spring Security but looks more on @WebMvcTest.
The test fail due to a 404. meaning spring can't find the mapping.
from spring-boot.
Thanks for your time.
from spring-boot.
Related Issues (20)
- Remove unnecessary null check
- Bump jfrog/setup-jfrog-cli from 4.0.2 to 4.1.2
- Autoconfigured HttpMessageConverter for Kotlin throws Exception for Java Enum. HOT 1
- Group Kafka properties that configure the back-off policy
- hiii HOT 1
- rustclient
- WebSocket autoconfiguration issue with messageBrokerTaskScheduler in 3.3.0 version HOT 3
- Document the need to switch to io.micrometer:micrometer-registry-prometheus-simpleclient to use the Prometheus push gateway HOT 1
- Gradle warning: Build service is being used by task without the corresponding declaration via 'Task#usesService' HOT 1
- Unable to apply jakartaConverter in spring boot embedded tomcat. HOT 1
- JSP-related resources may not be found in an executable war file when using Jetty
- OAuth2ClientAutoConfiguration Conditional on Servlet Application HOT 1
- Provide a way to link to versioned javadoc without redirecting to current HOT 6
- Kotlin runApplication<Application>(*args) isn't detecting Java Controllers. HOT 3
- Uber jar fails to start when it contains a dependency with Multi-Release: true in its manifest and unexpected file entries in META-INF/versions HOT 6
- Being able to scrape Prometheus metrics during graceful shutdown from management endpoints HOT 1
- Counts in ClassicHistogramBuckets cannot be negative issue after upgrade to spring boot 3.3 HOT 2
- Why I upgrade my springboot form 3.1.3 to 3.3.0 having errors? HOT 3
- ControllerAdvice/ExceptionHandler do not apply to non reactive RouterFunction HOT 1
- Uber jar fails to start when it contains a dependency with Multi-Release: true in its manifest and unexpected file entries in META-INF/versions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-boot.