Tag Archives: spring

Cannot parse local date time in Spring controller

Questions: In my Spring Boot application, I need to handle a form with date time field and convert it to LocalDateTime in Java. I specified pattern “YYYY-MM-dd HH:mm” and it fails to convert when I submit the form with input value 1990-01-01 10:10. Here is the form object: public class UserForm { @NotNull @DateTimeFormat(pattern =… Read More »

Spring boot-1.5.14 actuator endpoint 404 Not found

Questions: I have recently upgraded to spring-boot 1.5.14 and I can no longer access actuator endpoints. Even after adding management.security.enabled=false and management.endpoints.web.exposure.include=* I still get 404 error. Answers:

Map OneToMany recursive relationship in Spring Data

Questions: I want to map a recursive relationship between a category and a subcategory using Spring Data. I have the following code: @Entity public class Category { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @Column(nullable=false) private String name; @ManyToOne(cascade={CascadeType.ALL}) @JoinColumn(name=”parent_id”) private Category parentId; @OneToMany(mappedBy=”parentId”, cascade=CascadeType.ALL) private Set<Category>subcategories = new HashSet<Category>(); public Long getId() { return id; }… Read More »

Spring boot shut down after it starts

Questions: When I try to start my Spring Boot application throw Eclipse evrething is okey. But when I do into project folder and try to start application throw console (by command “java -jar target/MyApp-0.0.1-SNAPSHOT.jar”) I get some issue which I couldn’t even undertand what they are talking about 🙂 Here is screenshot below: enter image… Read More »

How to use the spring boot tests correctly?

Questions: I do not really understand how to properly use the tests in Spring. Do I really need to perform a full initialization of the entire Spring configuration to run the test? I have a final integration test, a normal controller call, and checking its response. I have to do it this way: @RunWith(SpringRunner.class) @SpringBootTest(webEnvironment… Read More »

How can I replace the deprecated Spring DistinguishedNameEditor?

Questions: We’re using the deprecated Spring-LDAP DistinguishedNameEditor with Spring 3.2.17 – very old, I know, which is why we want to upgrade. However, I can’t see a replacement PropertyEditor anywhere. How can we inject fields of type javax.naming.Name with Strings? <beans:bean class=”org.springframework.beans.factory.config.CustomEditorConfigurer”> <beans:property name=”customEditors”> <beans:map> <beans:entry key=”javax.naming.Name”> <beans:bean class=”org.springframework.ldap.core.DistinguishedNameEditor”/> </beans:entry> </beans:map> </beans:property> </beans:bean> Answers:

Zuul routing confusion in spring microservices

Questions: I have to spring microservices and being ran on docker containers each connecting to my discovery service being ran on port :8080. I see them all getting register and when i try to access one of the services doing for exmaple: localhost:8080/api/microservice-service-A/ it doesn’t seem to route. But i can connect to them directly… Read More »