spring-mvc

Spring boot use resources templates folder with JSP templates instead of webapp folder?

試著忘記壹切 提交于 2020-02-11 04:38:27
问题 I started a Spring Boot MVC project and realized that there are two folder within resources . One is called templates and the other static . I really like this folder setup. The problem is that I use JSP Templates for my views. I could not place a .jsp template inside the templates folder and got it to work. What I needed to do is to create a webapp folder on the same level as src and resources . Placing my JSP templates in there and then my views can be found. What do I need to reconfigure

Hibernate doesn't return proper objects in inner join

守給你的承諾、 提交于 2020-02-08 07:33:12
问题 I'm working on Spring MVC application that uses Hibernate. One of my requests in SQL looks like this: SELECT work_order.* FROM work_order inner join user on work_order.user_id = user.id and user.user_name = 'Jenna' and I do get a result as a row of workorders. When I'm trying to do the same with Hibernate I get five objects(which is correct) but can't convert into WorkoOrder objects. Here's my Hibernate request: List<WorkOrder> workorders = (List<WorkOrder>)currentSession.createQuery( "from

Hibernate doesn't return proper objects in inner join

女生的网名这么多〃 提交于 2020-02-08 07:30:13
问题 I'm working on Spring MVC application that uses Hibernate. One of my requests in SQL looks like this: SELECT work_order.* FROM work_order inner join user on work_order.user_id = user.id and user.user_name = 'Jenna' and I do get a result as a row of workorders. When I'm trying to do the same with Hibernate I get five objects(which is correct) but can't convert into WorkoOrder objects. Here's my Hibernate request: List<WorkOrder> workorders = (List<WorkOrder>)currentSession.createQuery( "from

Hibernate doesn't return proper objects in inner join

吃可爱长大的小学妹 提交于 2020-02-08 07:30:05
问题 I'm working on Spring MVC application that uses Hibernate. One of my requests in SQL looks like this: SELECT work_order.* FROM work_order inner join user on work_order.user_id = user.id and user.user_name = 'Jenna' and I do get a result as a row of workorders. When I'm trying to do the same with Hibernate I get five objects(which is correct) but can't convert into WorkoOrder objects. Here's my Hibernate request: List<WorkOrder> workorders = (List<WorkOrder>)currentSession.createQuery( "from

Using @CrossOrigin annotation with JAX-RS (Jersey)

馋奶兔 提交于 2020-02-07 11:24:50
问题 Is it possible to annotate @CrossOrigin(Spring-MVC) with JAX-RS(Jersey) bassed annotations? 回答1: You can create something like that by implementing ContainerRequestFilter and ContainerResponseFilter (see: Filters) with Annotation driven Name binding or Dynamic binding. Here an Annotation you could use for Name or Dynamic binding: import javax.ws.rs.NameBinding; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @NameBinding @Retention(RetentionPolicy.RUNTIME)

Redirect after POST method in spring MVC

 ̄綄美尐妖づ 提交于 2020-02-07 07:21:24
问题 My problem is that I want to redirect to my index page without having to see the attributes appended in the URL. I found the solution to be addFlashAttributes , it doesn't append attributes in the URL but I can't see any message saved by this method. Code: Controller @RequestMapping(value="/login",method = RequestMethod.POST) public ModelAndView loginResult(HttpServletRequest req, HttpServletResponse res, RedirectAttributes redir) { if (uname.equals(inf.getUsername()) & &pwd.equals(inf

Redirect after POST method in spring MVC

帅比萌擦擦* 提交于 2020-02-07 07:21:12
问题 My problem is that I want to redirect to my index page without having to see the attributes appended in the URL. I found the solution to be addFlashAttributes , it doesn't append attributes in the URL but I can't see any message saved by this method. Code: Controller @RequestMapping(value="/login",method = RequestMethod.POST) public ModelAndView loginResult(HttpServletRequest req, HttpServletResponse res, RedirectAttributes redir) { if (uname.equals(inf.getUsername()) & &pwd.equals(inf

Redirect after POST method in spring MVC

孤者浪人 提交于 2020-02-07 07:21:06
问题 My problem is that I want to redirect to my index page without having to see the attributes appended in the URL. I found the solution to be addFlashAttributes , it doesn't append attributes in the URL but I can't see any message saved by this method. Code: Controller @RequestMapping(value="/login",method = RequestMethod.POST) public ModelAndView loginResult(HttpServletRequest req, HttpServletResponse res, RedirectAttributes redir) { if (uname.equals(inf.getUsername()) & &pwd.equals(inf

JUnit Testing (with Spring MVC and Hibernate): IllegalArgumentException: Unknown entity

大兔子大兔子 提交于 2020-02-06 02:15:33
问题 I'm tryng to do some JUnit persistance tests. I'm using Spring MVC and Hibernate. I have my TestConfig file looking like this: @ComponentScan({"src.main.java.ar.edu.itba.paw.persistence", }) @Configuration public class TestConfig { @Bean public DataSource dataSource() { final SimpleDriverDataSource ds = new SimpleDriverDataSource(); ds.setDriverClass(JDBCDriver.class); ds.setUrl("jdbc:hsqldb:mem:paw"); ds.setUsername("ha"); ds.setPassword(""); return ds; } @Bean public

Not able to inject .properties file into Spring MVC 4.3 using @PropertySource

▼魔方 西西 提交于 2020-02-05 05:31:05
问题 I want to use .properties file to read mysql and hibernate properties using Environment and @PropertySources but I am getting error below java.io.FileNotFoundException: class path resource [ /com/properties/persistence/mysqldb.properties] cannot be opened because it does not exist Here is my project strutucture PersistenceConfig.java @Configuration @EnableJpaRepositories(basePackages="com.hp.model.repository") @EnableTransactionManagement @PropertySources({ @PropertySource("classpath: /com