I started developing an application using the microservices concept and I still have many doubts. I have repositories and their respective entities, the submissions of the requests work correctly however when I finish the application and start again I lose the data. For example, I send a post
that saves the data in the database, dou get
e I get it correctly however if I restart the application my get
does not return nothing .
Why does this occur? How do I get all the data?
Repository
@RepositoryRestResource(collectionResourceRel = "veiculos", path = "veiculos")
public interface VeiculoRepository extends MongoRepository<Veiculo, String> {
Veiculo save(Veiculo veiculo);
List<Veiculo> findAll();
}
Application.properties
spring.application.name=VeiculoService
spring.data.mongodb.uri=mongodb://localhost:27017/db
spring.data.rest.baseUri=/api
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.http.gzip.enabled=true
management.context-path=/actuator
info.app.name=Db Admin
info.app.description=DB
info.app.version=${project.version}
server.port=${port:8181}
server.servletPath=/