repository

Spring Data repository can't autowire

∥☆過路亽.° 提交于 2019-12-13 04:12:32
问题 I'm creating a new Spring Boot app from the scratch and want to write tests for it. I've just implemented authentication into my app and want to learn how roles work. When I use my UserRepository in the authentication process, everything works as it should. However, when I want to use UserRepository in tests, it says that the object is null, the same one that's OK when I use it in the app code. Why is that? Here's the code. Security configuration class: @Configuration @EnableWebSecurity

jersey archetype sun or glassfish

旧街凉风 提交于 2019-12-13 03:15:04
问题 I´m new with Jersey and I have problems with the installation. Specially with the error: Can't resolve Archetype org.glassfish.jersey.archetypes:jersey-heroku-webapp:2.26 I already looked for solutions: adding a remote catalog adding a new Maven Archetype locally proxy setting are working (I can access a web page using my internal browser) Now, I noticed that when creating a new Maven project and selecting the archetype it appears: com.sun.jersey.archetypes Can I use that to run jersey? or Is

In a MVC tiered architecture a Repository class is part of the Business layer or not?

心已入冬 提交于 2019-12-13 02:35:30
问题 suppose you have an MVC application with the Model represented by an Entity Framework (EF) that "gets" data from a database and the action methods of the Controller that implements all the business logic. The Controller gets data from the database through the EF. Imagine that now you create a Repository class that is placed between Controller and Model. This way you have: 1) Controller : implements most of the business logic; 2) A Repository class , responsible to implement simple business

Symfony2: How to Call functions in Repository class from Type

孤街醉人 提交于 2019-12-13 02:25:28
问题 I'm new in symfony2 ver 2.7: I would like to create registration number in form with data from count rows in existing table. It's OK when i create in PatientController and show the result in twig format. But i need show the result in text type form. I write in PatientRepository a function: public function getNumberPatient() { $qb = $this->createQueryBuilder('name') ->select('COUNT(name)'); return (int)$qb->getQuery() ->getSingleScalarResult(); } And in my Entity file to generate like this:

Free artifactory or nexus service url without password, for using in intellij idea

旧时模样 提交于 2019-12-13 02:07:39
问题 Intelliji Idea shiped with 3 free online repository in settings -> maven -> artifactory or nexus service url http://oss.sonatype.org/service/local/ http://repo.jfrog.org/artifactory/api/ https://repository.jboss.org/nexus/service/local/ all this repos are unavialable (404 error or password protected). Can you give more free artifactory or nexus service url without password protect? IDEA has no settings for password on repo URL. 回答1: IDEA uses the REST services to get listings of all the

Cannot convert Generic Class to Generic Interface, why?

家住魔仙堡 提交于 2019-12-13 01:38:39
问题 I have an IRepository interface that inherits from IRepository<TObject> . I also have a SqlRepository class that inherits from S QLRepository<TObject> , which in turn implements IRepository<TObject> . Why can't I instantiate a instance of SqlRepository as an IRepository? public class MyObject : IObject { ... } public interface IRepository<TObject> where TObject : IObject, new() { ... } public interface IRepository : IRepository<MyObject> { } public class SqlRepository<TObject> : IRepository

Best way to accept a generic method argument [closed]

天涯浪子 提交于 2019-12-13 01:27:54
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . I got a interface which describes a way to do some action on some item which is looked up in some repository. And i see two ways to create that interface. public interface IService<T> where T : class { void Action<TSource>(int id, TSource source, Action<T> action) where TSource : IRead<T>; } versus public

Is it possible to deploy artifacts from local folder in Sonatype Nexus Repository Manager 3.x

妖精的绣舞 提交于 2019-12-12 22:31:38
问题 I use Sonatype Nexus Repository Manager 3.5.2 and want to add artifacts to nexus blob store from local folder ( where nexus is lockated ). I couldn't find solution in Nexus documentation and tryed to find in the Net - unsuccessfully . Is it possible and how to do this ( maybe Nexus has some plugin )? thx for any help ..... Update: I have found a solution -> see Answers. 回答1: I have found a temporary solution (I checked Nexus documentation and did not found paragraph about it) => I have shared

git - how to mirror file from other repo

只谈情不闲聊 提交于 2019-12-12 22:30:06
问题 I've a problem which probably can't be solved, but I'll ask anyway. I do have one git repository, and I need one file to be mirrored from another one. There is one .xsd file in the repo I need to have in my repository. That's not the biggest problem. I want to update that file (on git fetch for instance), to the version of the last tag on the repository containing .xsd file. Any help is really appreciated 回答1: You can use post-checkout (or maybe some more appropriate) hook to replace the

Spring. How exception translation works?

对着背影说爱祢 提交于 2019-12-12 22:18:30
问题 I have following code: @Repository public class UserDAOImpl implements UserDAO { public void addUser(User user) { throw new HibernateException("unchecked exception"); } } @Service public class UserServiceImpl implements UserService { @Autowired private UserDAO userDAO; @Override public void addUser(User user) { try { userDAO.addUser(user); } catch (Exception e) { e.printStackTrace(); } } } web.xml: <context:component-scan base-package="org.example.dao, org.example.services"/> <mvc:annotation