spring-best-practices | spring 最佳实践 Demo案例 | Security library
kandi X-RAY | spring-best-practices Summary
kandi X-RAY | spring-best-practices Summary
spring 最佳实践 Demo案例
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Process from token
- Process non - aliased multi - tables
- Process aliases
- Handle validation exception handler
- Handle validate exception
- Runs the tool
- Downloads a file from a URL
- Around method point
- Parse params
- Normalizes the token so it can be used as a token
- Remove comments from the SQL statement
- List user
- Region init config
- Bean task executor
- Retrieves the current authentication user
- Initialize rest template interceptors
- Create SqlInfo from metaObject
- Around method
- Intercept the request
- The simple client http request factory bean
- Determines if the given token is a create index
- Checks if is Oracle special delete special characters
- Register interceptors
spring-best-practices Key Features
spring-best-practices Examples and Code Snippets
Community Discussions
Trending Discussions on spring-best-practices
QUESTION
Front-End dev here working on my first Java Spring Boot API. I've been reading many articles on the "best practices" in Spring/Spring Boot and have been attempting to refactor my code to follow those practices.
Below I have an example of a generic class I use to handle all HTTP requests for my various services. Originally I had this class annotated with the @Component annontation, but as I mentioned I am trying to learn and follow Spring "best practices." In particular I am interested in implementing what this article on best practices describes (Number 3 & 4 in the article). That says one should avoid using @component, because we don't want to be tightly coupled to the Spring framework and we want to avoid "entire class path scanning."
...ANSWER
Answered 2019-Aug-22 at 19:57Adding @Component
to your class forces anyone who uses your class to know about Spring (i.e. spring is a compile time dependency).
The easiest alternative is to create separate class annotated with @Configuration
in your app, and let it handle creating your class a Spring bean.
For example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install spring-best-practices
You can use spring-best-practices like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the spring-best-practices component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page