Here is an easiest way to do it via annotation:
import org.springframework.core.io.Resource;
@Value("classpath:<path to file>")
private Resource cert;
Related Contents:
- Spring Boot access static resources missing scr/main/resources
- How can I log SQL statements in Spring Boot?
- How to respond with an HTTP 400 error in a Spring MVC @ResponseBody method returning String
- Mockito: Inject real objects into private @Autowired fields
- REST API – DTOs or not? [closed]
- Execute method on startup in Spring
- How to count members with jsonpath?
- How does Spring Data JPA differ from Hibernate for large projects?
- ContextLoaderListener or not?
- Missing CrudRepository#findOne method
- Thymeleaf: how to use conditionals to dynamically add/remove a CSS class
- JdbcTemplate queryForInt/Long is deprecated in Spring 3.2.2. What should it be replaced by?
- spring scoped proxy bean
- How to Autowire Bean of generic type in Spring?
- Spring Data JPA findOne() change to Optional how to use this?
- Spring vs EJB. Can Spring replace EJB? [closed]
- How to return 404 response status in Spring Boot @ResponseBody – method return type is Response?
- Is it possible to add qualifiers in @RequiredArgsConstructor(onConstructor = @__(@Autowired))?
- Spring RedirectAttributes: addAttribute() vs addFlashAttribute()
- Set Logging Level in Spring Boot via Environment Variable
- Maven + Spring Boot: Found multiple occurrences of org.json.JSONObject on the class path:
- Where is the application.properties file in a Spring Boot project?
- Spring not autowiring in unit tests with JUnit
- Transactional saves without calling update method
- How to enable HTTP response caching in Spring Boot
- How do you set cache headers in Spring MVC?
- Right way to write JSON deserializer in Spring or extend it
- How to reload authorities on user update with Spring Security
- Spring — inject 2 beans of same type
- Using spring HATEOAS with spring webflux Functional Web Framework (reactor-netty)
- Spring HTTP Client
- How to prevent parameter binding from interpreting commas in Spring 3.0.5?
- No Dialect mapping for JDBC type: 1111
- how to show query while using query annotations with MongoRepository with spring data
- How to make spring boot never issue session cookie?
- Difference between path and value attributes in @RequestMapping annotation
- How do you turn off swagger-ui in production
- How can I set a description and an example in Swagger with Swagger annotations?
- W/System: A resource failed to call release
- Spring-Boot How to properly inject javax.validation.Validator
- How can I shutdown Spring task executor/scheduler pools before all other beans in the web app are destroyed?
- Hot swapping in Spring Boot
- What naming convention do you use for the service layer in a Spring MVC application? [closed]
- Spring scheduling task – run only once
- How can I get a Spring bean in a servlet filter?
- Could not autowire org.springframework.mail.javamail.JavaMailSender
- Where “user” comes from in convertAndSendToUser works in SockJS+Spring Websocket?
- JPA Transient Annotation and JSON
- JPA thinks I’m deleting a detached object
- Prevent stack trace logging for custom exception in Spring Boot application